diff --git a/Gameplay/Actor.cs b/Gameplay/Actor.cs index fb7a2aa..2a4bbfa 100644 --- a/Gameplay/Actor.cs +++ b/Gameplay/Actor.cs @@ -6,6 +6,7 @@ using System.Linq; public partial class Actor : Node { public bool _available, _hovered, _selected; + public CollisionShape2D _startArea; public List _cues = new(); public Cue _selectedCue = null; public List _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("Image").Texture; } - _tempBallSprite.Position = mousePosition; + if (_startArea == null) + { + _startArea = Globals.Instance._currentBattle.GetNode("Table").GetNode("PlayerStartArea").GetNode("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("StartPosition").Position = mousePosition; - if (Input.IsActionJustReleased("left_click")) - { - _activeBall.Place(GetNode("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(); diff --git a/Gameplay/Ball.cs b/Gameplay/Ball.cs index 4e2e38e..f78d6fc 100644 --- a/Gameplay/Ball.cs +++ b/Gameplay/Ball.cs @@ -46,7 +46,6 @@ public partial class Ball : RigidBody2D } else if (LinearVelocity.Length() >= _moveThreshold) { - GD.Print(Position); if (!_moving) { _moving = true; diff --git a/Gameplay/Battle.cs b/Gameplay/Battle.cs index e415d36..6762496 100644 --- a/Gameplay/Battle.cs +++ b/Gameplay/Battle.cs @@ -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("PottedPanel"); Sprite2D ballSprite = new Sprite2D(); AddChild(ballSprite); ballSprite.Texture = BODY.GetNode("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(); diff --git a/Gameplay/Cue.cs b/Gameplay/Cue.cs index 296b548..5e87459 100644 --- a/Gameplay/Cue.cs +++ b/Gameplay/Cue.cs @@ -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); diff --git a/Gameplay/Main.cs b/Gameplay/Main.cs index 80eeb55..cea42f4 100644 --- a/Gameplay/Main.cs +++ b/Gameplay/Main.cs @@ -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(); + } + } + } diff --git a/Gameplay/battle.tscn b/Gameplay/battle.tscn index 134eba4..1476f51 100644 --- a/Gameplay/battle.tscn +++ b/Gameplay/battle.tscn @@ -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") diff --git a/Gameplay/table.tscn b/Gameplay/table.tscn index fd4646f..b96f797 100644 --- a/Gameplay/table.tscn +++ b/Gameplay/table.tscn @@ -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") diff --git a/addons/godot-git-plugin/win64/~libgit_plugin.windows.editor.x86_64.dll b/addons/godot-git-plugin/win64/~libgit_plugin.windows.editor.x86_64.dll deleted file mode 100644 index 47bbb1d..0000000 Binary files a/addons/godot-git-plugin/win64/~libgit_plugin.windows.editor.x86_64.dll and /dev/null differ diff --git a/art/tableTemplate.png b/art/tableTemplate.png new file mode 100644 index 0000000..10a4ce7 Binary files /dev/null and b/art/tableTemplate.png differ diff --git a/art/tableTemplate.png.import b/art/tableTemplate.png.import new file mode 100644 index 0000000..c0b6213 --- /dev/null +++ b/art/tableTemplate.png.import @@ -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 diff --git a/project.godot b/project.godot index 93e723a..3d9c1cc 100644 --- a/project.godot +++ b/project.godot @@ -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]