diff options
author | altaf-creator <dev@altafcreator.com> | 2024-04-14 23:00:45 +0700 |
---|---|---|
committer | altaf-creator <dev@altafcreator.com> | 2024-04-14 23:00:45 +0700 |
commit | f1b4d6034c937c89b2750bc209684a4e19896177 (patch) | |
tree | f91731656ff901e458ab504b8e8e33fb06e67c0b /Scripts/Player.gd | |
parent | 21d3893b6b1c1ffb2d9611bce67568e713161b3d (diff) |
Art overhaul
Diffstat (limited to 'Scripts/Player.gd')
-rw-r--r-- | Scripts/Player.gd | 11 |
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 |