Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,12 @@ var _hook_angle: float
## diagonal directions when releasing the input actions.
@onready var d_pad_timer: Timer = %DPadTimer

@onready var mouse_aiming_timer: Timer = %MouseAimingTimer


func _unhandled_input(_event: InputEvent) -> void:
if _event is InputEventMouseMotion:
mouse_aiming_timer.start()
var axis := get_global_mouse_position() - global_position
if not axis.is_zero_approx():
_hook_angle = axis.angle()
Expand All @@ -102,7 +105,8 @@ func _unhandled_input(_event: InputEvent) -> void:
# there is always one that is released first so the aim direction ends up being either left or
# down, not left AND down.
if (
_event is InputEventKey
mouse_aiming_timer.is_stopped()
and _event is InputEventKey
and (
_event.is_action_released(&"aim_left")
or _event.is_action_released(&"aim_right")
Expand All @@ -113,7 +117,8 @@ func _unhandled_input(_event: InputEvent) -> void:
d_pad_timer.start()
return

_update_hook_angle()
if mouse_aiming_timer.is_stopped():
_update_hook_angle()

if Input.is_action_just_pressed(&"throw"):
pressing_throw_action = true
Expand Down
5 changes: 5 additions & 0 deletions scenes/game_elements/props/hook_control/hook_control.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,9 @@ unique_name_in_owner = true
wait_time = 0.2
one_shot = true

[node name="MouseAimingTimer" type="Timer" parent="." unique_id=405211158]
unique_name_in_owner = true
wait_time = 3.0
one_shot = true

[connection signal="timeout" from="DPadTimer" to="." method="_on_d_pad_timer_timeout"]
2 changes: 1 addition & 1 deletion scenes/globals/mouse_manager/mouse_manager.gd
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func _ready() -> void:
func _input(event: InputEvent) -> void:
if event is InputEventMouseMotion:
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
hide_timer.start(3)
hide_timer.start()


func _on_hide_timer_timeout() -> void:
Expand Down
Loading