mirror of
https://github.com/GDQuest/godot-platformer-2d.git
synced 2026-07-17 16:34:54 +00:00
Restore gamepad aim
This commit is contained in:
parent
13f090df51
commit
e2380b2d68
2 changed files with 6 additions and 2 deletions
|
|
@ -38,7 +38,11 @@ func can_hook() -> bool:
|
|||
|
||||
func get_aim_direction() -> Vector2:
|
||||
var direction: = Vector2.ZERO
|
||||
direction = (get_global_mouse_position() - global_position).normalized()
|
||||
match Settings.controls:
|
||||
Settings.GAMEPAD:
|
||||
direction = Utils.get_aim_joystick_direction()
|
||||
Settings.KBD_MOUSE, _:
|
||||
direction = (get_global_mouse_position() - global_position).normalized()
|
||||
return direction
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ func unhandled_input(event: InputEvent) -> void:
|
|||
|
||||
|
||||
func physics_process(delta: float) -> void:
|
||||
var cast: Vector2 = owner.get_aim_direction() * owner.ray_cast.cast_to.length()
|
||||
var cast: Vector2 = owner.get_aim_direction() * owner._radius
|
||||
var angle: = cast.angle()
|
||||
owner.ray_cast.cast_to = cast
|
||||
owner.arrow.rotation = angle
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue