Skip to content

Commit

Permalink
add dead zone to controller input
Browse files Browse the repository at this point in the history
  • Loading branch information
Nartynka committed Sep 26, 2022
1 parent 8894eaa commit 2650006
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions Player/Player.gd
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,12 @@ func apply_gravity(delta):

func update_animation(input_vector):
if Utils.controller_connected:
if Input.get_joy_axis(0, JOY_AXIS_0) > 0:
sprite.scale.x = 1
else:
sprite.scale.x = -1
var input = Input.get_joy_axis(0, JOY_AXIS_0)
if abs(input) > 0.3:
if input > 0:
sprite.scale.x = 1
else:
sprite.scale.x = -1
else:
sprite.scale.x = sign(get_local_mouse_position().x)
if input_vector.x!=0:
Expand Down

0 comments on commit 2650006

Please sign in to comment.