diff options
author | altaf-creator <dev@altafcreator.com> | 2024-04-13 21:50:12 +0700 |
---|---|---|
committer | altaf-creator <dev@altafcreator.com> | 2024-04-13 21:50:12 +0700 |
commit | b97ebd793eb17032f3929f307dfe644b17714619 (patch) | |
tree | 03a558e77757112a6fddce45dbbcc0139df479c2 /Scripts/Player.gd | |
parent | c5a806528af8a4de5f903d26cd33edb7e0bb6597 (diff) |
bare bones ai, softlock issues
Diffstat (limited to 'Scripts/Player.gd')
-rw-r--r-- | Scripts/Player.gd | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Scripts/Player.gd b/Scripts/Player.gd index e422ba8..f3b9667 100644 --- a/Scripts/Player.gd +++ b/Scripts/Player.gd @@ -6,8 +6,11 @@ class_name Player var target : NumberNode var legal : bool +var gameloop : GameLoop + func _ready(): GlobalVariables.player = self + gameloop = GlobalVariables.gameloop func _input(event): if GlobalVariables.is_snapping: @@ -25,8 +28,9 @@ func _input(event): if event is InputEventMouseButton && !event.pressed: GlobalVariables.is_snapping = false - if target != null: + if target != null && gameloop.current_turns < gameloop.turns: target.join_from($"..") + gameloop.current_turns += 1 line.points[1] = Vector2.ZERO |