diff --git a/Gameplay/Manager.cs b/Gameplay/Manager.cs index dd47188..f4fd600 100644 --- a/Gameplay/Manager.cs +++ b/Gameplay/Manager.cs @@ -133,11 +133,24 @@ public partial class Manager : Node } else if (_selectedNode is BallSprite) { - + Vector2 mousePosition = GetViewport().GetMousePosition(); + ((BallSprite)_selectedNode).Position = mousePosition; + if (Input.IsActionJustReleased("left_click")) + { + if (!_table._kitchenHovered) + { + PlaceBall(((BallSprite)_selectedNode), mousePosition); + _hoveredNode = null; + _selectedNode = null; + } + } } else if (_hoveredNode is BallSprite) { - + if (Input.IsActionJustReleased("left_click")) + { + _selectedNode = (BallSprite)_hoveredNode; + } } } else @@ -256,6 +269,7 @@ public partial class Manager : Node ball._placed = true; ball._potted = false; ball._active = true; + ball.Rotation = 0; if (!GetChildren().Contains(ball)) { @@ -291,7 +305,16 @@ public partial class Manager : Node BallSprite ballSprite = GetSpriteFromBall(BALL); int pottedCount = _ballReturn._returnCount; - ballSprite.Position = new Vector2(_ballReturn.GlobalPosition.X + _ballReturn.Size.X / 2, _ballReturn.GlobalPosition.Y + 50 * (pottedCount + 1)); + Vector2 position; + if (BALL._isCue) + { + position = _kitchen.GlobalPosition; + } + else + { + position = new Vector2(_ballReturn.GlobalPosition.X + _ballReturn.Size.X / 2, _ballReturn.GlobalPosition.Y + 50 * (pottedCount + 1)); + } + ballSprite.Position = position; ballSprite._active = true; if (!GetChildren().Contains(ballSprite)) {