a game about throwing hammers made for the github game off
fix aim not being exitable on joypad
| -rw-r--r-- | autoloads/Utils.gd | 2 | ||||
| -rw-r--r-- | ui/components/aim/aim.gd | 4 |
2 files changed, 2 insertions, 4 deletions
diff --git a/autoloads/Utils.gd b/autoloads/Utils.gd index d04df53..484e146 100644 --- a/autoloads/Utils.gd +++ b/autoloads/Utils.gd @@ -2,7 +2,7 @@ extends Node class_name Util static func is_in_range(val: float, start: float, end: float) -> bool: - return val > start and val < end + return val >= start and val <= end static func instance_scene(scene: PackedScene, position: Vector2, on: Node) -> Node: var instance := scene.instantiate() as Node2D diff --git a/ui/components/aim/aim.gd b/ui/components/aim/aim.gd index 41460a2..f822182 100644 --- a/ui/components/aim/aim.gd +++ b/ui/components/aim/aim.gd @@ -28,14 +28,12 @@ func _process(delta: float) -> void: return if v.is_zero_approx(): v.x = Globals.player.sprite.scale.x # default to current facing direction - elif v.y == Vector2.DOWN.y and Util.is_in_range(v.x, -0.1, 0.1) and Globals.player.is_on_floor(): + elif Utils.is_in_range(v.y, 0.9, 1) and Util.is_in_range(v.x, -0.1, 0.1) and Globals.player.is_on_floor(): cancel_left_time -= delta if cancel_left_time < 0: cancel_left_time = cancel_time cancel.emit() return - else: - cancel_left_time = cancel_time var angle := v.angle() current_rotation = angle arrow.rotation = angle |