From b97ebd793eb17032f3929f307dfe644b17714619 Mon Sep 17 00:00:00 2001 From: altaf-creator Date: Sat, 13 Apr 2024 21:50:12 +0700 Subject: bare bones ai, softlock issues --- Scripts/Player.gd | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'Scripts/Player.gd') 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 -- cgit v1.2.3