7-16-25 @ 3:27AM

This commit is contained in:
2025-07-16 03:27:01 -04:00
parent 7c81e03613
commit c5795028f0
11 changed files with 102 additions and 105 deletions

View File

@@ -6,6 +6,7 @@ using System.Linq;
public partial class Actor : Node
{
public bool _available, _hovered, _selected;
public CollisionShape2D _startArea;
public List<Cue> _cues = new();
public Cue _selectedCue = null;
public List<Ball> _balls = new();
@@ -45,7 +46,6 @@ public partial class Actor : Node
{
if (_ballBag.Count > 0)
{
<<<<<<< HEAD
if (_heldBall == null)
{
_heldBall = _ballBag[0];
@@ -67,10 +67,15 @@ public partial class Actor : Node
}
_tempBallSprite.Texture = _heldBall.GetNode<Sprite2D>("Image").Texture;
}
_tempBallSprite.Position = mousePosition;
if (_startArea == null)
{
_startArea = Globals.Instance._currentBattle.GetNode<Table>("Table").GetNode<Area2D>("PlayerStartArea").GetNode<CollisionShape2D>("CollisionShape2D");
}
_tempBallSprite.Position = new Vector2(Math.Min(Math.Max(mousePosition.X, _startArea.GlobalPosition.X - ((RectangleShape2D)(_startArea.Shape)).Size.X / 2), _startArea.GlobalPosition.X + ((RectangleShape2D)(_startArea.Shape)).Size.X / 2), Math.Min(Math.Max(mousePosition.Y, _startArea.GlobalPosition.Y - ((RectangleShape2D)(_startArea.Shape)).Size.Y / 2), _startArea.GlobalPosition.Y + ((RectangleShape2D)(_startArea.Shape)).Size.Y / 2));
if (Input.IsActionJustReleased("left_click"))
{
_heldBall.Place(mousePosition);
_heldBall.Place(_tempBallSprite.Position);
AddChild(_heldBall);
int ballIndex = _ballBag.IndexOf(_heldBall);
_ballBag.Remove(_heldBall);
@@ -79,15 +84,6 @@ public partial class Actor : Node
{
_heldBall = _ballBag[ballIndex - (ballIndex > _ballBag.Count ? 1 : 0)];
}
=======
_activeCue.HideCue();
Vector2 mousePosition = GetViewport().GetMousePosition();
GetNode<Marker2D>("StartPosition").Position = mousePosition;
if (Input.IsActionJustReleased("left_click"))
{
_activeBall.Place(GetNode<Marker2D>("StartPosition").Position);
GD.Print(_activeBall.Position);
>>>>>>> 920c5c27fb732c902987b01dcc093e55b1552a9f
}
}
else
@@ -110,25 +106,21 @@ public partial class Actor : Node
{
if (Input.IsActionJustReleased("left_click"))
{
GD.Print(_selectedBall);
_selectedBall = _hoveredBall;
_selectedBall._selected = true;
_selectedCue.Don(_selectedBall);
GD.Print(_selectedBall);
}
}
else if (Input.IsActionJustReleased("right_click"))
{
GD.Print(2);
_selectedBall._selected = false;
_selectedBall = null;
_selectedCue.Doff();
}
else if (_hoveredBall == null)
{
if (Input.IsActionJustReleased("left_click") && _selectedCue._power == 0)
if (Input.IsActionJustReleased("left_click") && _selectedBall != null && _selectedCue._power == 0)
{
GD.Print(3);
_selectedBall._selected = false;
_selectedBall = null;
_selectedCue.Doff();

View File

@@ -46,7 +46,6 @@ public partial class Ball : RigidBody2D
}
else if (LinearVelocity.Length() >= _moveThreshold)
{
GD.Print(Position);
if (!_moving)
{
_moving = true;

View File

@@ -85,21 +85,17 @@ public partial class Battle : Node
}
if (BODY == _player._actor._selectedBall)
{
<<<<<<< HEAD
_player._actor._selectedBall._potted = true;
_player._actor._selectedBall._placed = false;
=======
_player._actor._activeBall._potted = true;
_player._actor._activeBall._placed = false;
>>>>>>> 920c5c27fb732c902987b01dcc093e55b1552a9f
}
else
{
Panel pottedPanel = GetNode<Panel>("PottedPanel");
Sprite2D ballSprite = new Sprite2D();
AddChild(ballSprite);
ballSprite.Texture = BODY.GetNode<Sprite2D>("Image").Texture;
_potted.Add(ballSprite);
ballSprite.Position = new Vector2(50 * _potted.Count, 725);
ballSprite.Position = new Vector2(pottedPanel.Position.X + pottedPanel.Size.X / 2, pottedPanel.Position.Y + (50 * _potted.Count));
((Ball)BODY)._placed = false;
((Ball)BODY)._potted = true;
BODY.QueueFree();

View File

@@ -79,8 +79,8 @@ public partial class Cue : Sprite2D
public void Don(Ball CUEBALL)
{
_donned = true;
Position = CUEBALL.Position;
_donned = true;
SetProcess(true);
Show();
//_progressBar.Position = new Vector2(CUEBALL.Position.X - _progressBar.Size.X / 2, CUEBALL.Position.Y + _progressBar.Size.Y / 2);

View File

@@ -5,6 +5,15 @@ public partial class Main : Node
{
public override void _Ready()
{
}
public override void _Process(double DELTA_)
{
if (Input.IsActionJustReleased("quit_game"))
{
GetTree().Quit();
}
}
}

View File

@@ -15,11 +15,13 @@ border_width_bottom = 2
script = ExtResource("1_i431l")
[node name="Table" parent="." instance=ExtResource("2_6t8i5")]
position = Vector2(357, 539)
[node name="Player" parent="." instance=ExtResource("2_ogveh")]
[node name="PottedPanel" type="Panel" parent="."]
offset_top = 678.0
offset_right = 1200.0
offset_bottom = 778.0
offset_left = 694.0
offset_top = 123.0
offset_right = 815.0
offset_bottom = 1003.0
theme_override_styles/panel = SubResource("StyleBoxFlat_tivnh")

View File

@@ -1,6 +1,6 @@
[gd_scene load_steps=12 format=3 uid="uid://dsprg4uahkylm"]
[gd_scene load_steps=10 format=3 uid="uid://dsprg4uahkylm"]
[ext_resource type="Texture2D" uid="uid://df2xulwx34fi" path="res://art/table.png" id="1_kl0hw"]
[ext_resource type="Texture2D" uid="uid://brbok0al4e1ab" path="res://art/tableTemplate.png" id="1_s3o1g"]
[ext_resource type="Script" uid="uid://82h0dmyohfj1" path="res://Gameplay/Table.cs" id="1_v5i0k"]
[sub_resource type="PhysicsMaterial" id="PhysicsMaterial_v5i0k"]
@@ -15,10 +15,6 @@ height = 264.0
radius = 74.0
height = 264.0
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_vjl2i"]
radius = 28.75
height = 154.0
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_67vji"]
radius = 74.0
height = 264.0
@@ -28,122 +24,85 @@ radius = 74.0
height = 264.0
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_bhh2s"]
radius = 28.75
radius = 24.0
height = 154.0
[sub_resource type="CircleShape2D" id="CircleShape2D_v5i0k"]
radius = 15.0333
[sub_resource type="RectangleShape2D" id="RectangleShape2D_s3o1g"]
size = Vector2(192.5, 520)
size = Vector2(394, 182)
[node name="Table" type="Sprite2D"]
texture_filter = 1
texture = ExtResource("1_kl0hw")
centered = false
texture = ExtResource("1_s3o1g")
script = ExtResource("1_v5i0k")
[node name="Cushions" type="StaticBody2D" parent="."]
physics_material_override = SubResource("PhysicsMaterial_v5i0k")
[node name="TL" type="CollisionPolygon2D" parent="Cushions"]
position = Vector2(404, 650)
rotation = 3.14159
polygon = PackedVector2Array(-153, 47, -160, 26, -160, -128, 314, -127, 314, 27.9999, 292, 47)
[node name="T" type="CollisionPolygon2D" parent="Cushions"]
position = Vector2(29, 410)
rotation = -1.5708
polygon = PackedVector2Array(-153, 48, -171, 29, -173, -129, 314, -127, 314, 27.9999, 292, 47.9999)
position = Vector2(-600, -339)
polygon = PackedVector2Array(160, -87, 360, -86, 380, -64, 379, 303, 360, 314, 158, 314)
[node name="TR" type="CollisionPolygon2D" parent="Cushions"]
position = Vector2(260, 31)
polygon = PackedVector2Array(-149, 47, -169, 27, -172, -130, 303, -127, 306, 25, 292, 47)
[node name="BR" type="CollisionPolygon2D" parent="Cushions"]
position = Vector2(783, 29)
polygon = PackedVector2Array(-153, 47, -160, 26, -160, -128, 318, -126, 320, 28, 298, 47)
[node name="B" type="CollisionPolygon2D" parent="Cushions"]
position = Vector2(1172, 270)
rotation = 1.5708
polygon = PackedVector2Array(-153, 47, -175, 26, -175, -138, 314, -127, 314, 25, 292, 47)
polygon = PackedVector2Array(220, -404, 240, -427, 449, -427, 448, -26, 241, -26, 220, -36)
[node name="BL" type="CollisionPolygon2D" parent="Cushions"]
position = Vector2(943, 648)
rotation = 3.14159
polygon = PackedVector2Array(-139, 47.0001, -160, 26, -160, -128, 320, -127, 319, 28, 310, 47)
polygon = PackedVector2Array(-221, 35, -240, 24, -436, 25, -434, 425, -241, 426, -221, 405)
[node name="BR" type="CollisionPolygon2D" parent="Cushions"]
polygon = PackedVector2Array(219, 36, 239, 24, 447, 24, 448, 426, 240, 426, 219, 403)
[node name="B" type="CollisionPolygon2D" parent="Cushions"]
polygon = PackedVector2Array(-186, 440, -206, 459, -207, 644, 206, 655, 205, 460, 186, 440)
[node name="T" type="CollisionPolygon2D" parent="Cushions"]
polygon = PackedVector2Array(-186, -441, -206, -459, -206, -630, 205, -631, 205, -459, 186, -440)
[node name="PocketTL" type="Area2D" parent="."]
position = Vector2(-279, -559)
[node name="CollisionShape2D" type="CollisionShape2D" parent="PocketTL"]
position = Vector2(13, 717)
shape = SubResource("CapsuleShape2D_v5i0k")
[node name="PocketTR" type="Area2D" parent="."]
position = Vector2(281, -562)
[node name="CollisionShape2D" type="CollisionShape2D" parent="PocketTR"]
position = Vector2(13, -36)
shape = SubResource("CapsuleShape2D_kl0hw")
[node name="PocketR" type="Area2D" parent="."]
[node name="CollisionShape2D" type="CollisionShape2D" parent="PocketR"]
position = Vector2(593.25, -19)
shape = SubResource("CapsuleShape2D_vjl2i")
[node name="PocketBR" type="Area2D" parent="."]
position = Vector2(281, 558)
[node name="CollisionShape2D" type="CollisionShape2D" parent="PocketBR"]
position = Vector2(1177, -37)
shape = SubResource("CapsuleShape2D_67vji")
[node name="PocketBL" type="Area2D" parent="."]
position = Vector2(-281, 558)
[node name="CollisionShape2D" type="CollisionShape2D" parent="PocketBL"]
position = Vector2(1178, 715)
shape = SubResource("CapsuleShape2D_jry6c")
[node name="PocketL" type="Area2D" parent="."]
[node name="PocketR" type="Area2D" parent="."]
position = Vector2(314, -2)
[node name="CollisionShape2D" type="CollisionShape2D" parent="PocketL"]
position = Vector2(593.25, 697)
[node name="CollisionShape2D" type="CollisionShape2D" parent="PocketR"]
rotation = 1.5708
shape = SubResource("CapsuleShape2D_bhh2s")
[node name="Pots" type="Area2D" parent="."]
[node name="PocketL" type="Area2D" parent="."]
position = Vector2(-315, -1)
[node name="TL" type="CollisionShape2D" parent="Pots"]
position = Vector2(55, 617)
shape = SubResource("CircleShape2D_v5i0k")
[node name="TR" type="CollisionShape2D" parent="Pots"]
position = Vector2(56, 63)
shape = SubResource("CircleShape2D_v5i0k")
[node name="R" type="CollisionShape2D" parent="Pots"]
position = Vector2(593, 43)
shape = SubResource("CircleShape2D_v5i0k")
[node name="BR" type="CollisionShape2D" parent="Pots"]
position = Vector2(1135, 63)
shape = SubResource("CircleShape2D_v5i0k")
[node name="BL" type="CollisionShape2D" parent="Pots"]
position = Vector2(1135, 616)
shape = SubResource("CircleShape2D_v5i0k")
[node name="L" type="CollisionShape2D" parent="Pots"]
position = Vector2(593, 634)
shape = SubResource("CircleShape2D_v5i0k")
[node name="CollisionShape2D" type="CollisionShape2D" parent="PocketL"]
rotation = 1.5708
shape = SubResource("CapsuleShape2D_bhh2s")
[node name="PlayerStartArea" type="Area2D" parent="."]
position = Vector2(-1, 312)
[node name="CollisionShape2D" type="CollisionShape2D" parent="PlayerStartArea"]
position = Vector2(983.75, 340)
shape = SubResource("RectangleShape2D_s3o1g")
[node name="EnemyStartArea" type="Area2D" parent="."]
position = Vector2(-1, -312)
[node name="CollisionShape2D" type="CollisionShape2D" parent="EnemyStartArea"]
position = Vector2(216, 340)
shape = SubResource("RectangleShape2D_s3o1g")

BIN
art/tableTemplate.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

View File

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://brbok0al4e1ab"
path="res://.godot/imported/tableTemplate.png-5727e3ffce0d6fa136d11b8d1932cdc8.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://art/tableTemplate.png"
dest_files=["res://.godot/imported/tableTemplate.png-5727e3ffce0d6fa136d11b8d1932cdc8.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

View File

@@ -21,8 +21,9 @@ Globals="*res://Gameplay/Globals.cs"
[display]
window/size/viewport_width=1200
window/size/viewport_height=778
window/size/viewport_width=1920
window/size/viewport_height=1080
window/size/mode=3
[dotnet]
@@ -94,6 +95,11 @@ shift={
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194325,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
]
}
quit_game={
"deadzone": 0.2,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194305,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
]
}
[physics]