summaryrefslogtreecommitdiff
path: root/Scripts/Player.gd
diff options
context:
space:
mode:
Diffstat (limited to 'Scripts/Player.gd')
-rw-r--r--Scripts/Player.gd11
1 files changed, 6 insertions, 5 deletions
diff --git a/Scripts/Player.gd b/Scripts/Player.gd
index f3b9667..a7b398a 100644
--- a/Scripts/Player.gd
+++ b/Scripts/Player.gd
@@ -13,7 +13,8 @@ func _ready():
gameloop = GlobalVariables.gameloop
func _input(event):
- if GlobalVariables.is_snapping:
+ if GlobalVariables.is_snapping && gameloop.can_play && gameloop.current_turns < gameloop.turns:
+ line.visible = true
var target_pos = (line.global_position - get_viewport().get_mouse_position())
var dist = sqrt(abs(target_pos.x) * abs(target_pos.x) + abs(target_pos.y) * abs(target_pos.y))
@@ -27,17 +28,17 @@ func _input(event):
if event is InputEventMouseButton && !event.pressed:
GlobalVariables.is_snapping = false
+ line.points[1] = Vector2.ZERO
+ line.visible = false
- if target != null && gameloop.current_turns < gameloop.turns:
+ if target != null && gameloop.can_play && gameloop.current_turns < gameloop.turns:
target.join_from($"..")
gameloop.current_turns += 1
-
- line.points[1] = Vector2.ZERO
if target != null:
line.rotation = 0
line.points[1] = -(line.global_position - target.global_position)
func _on_player_area_2d_input_event(_viewport : Node, event : InputEvent, _shape_idx : int):
- if event is InputEventMouseButton && event.pressed:
+ if event is InputEventMouseButton && event.pressed && gameloop.can_play && gameloop.current_turns < gameloop.turns:
GlobalVariables.is_snapping = true