Advertisement
Guest User

Player.gd

a guest
Sep 29th, 2020
940
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. extends KinematicBody2D
  2.  
  3. onready var animatedSprite = $AnimatedSprite
  4.  
  5. func _physics_process(delta):
  6. var axisX = Input.get_action_strength("ui_right") - Input.get_action_strength("ui_left")
  7.  
  8. if axisX > 0:
  9. animatedSprite.animation = "run"
  10. animatedSprite.flip_h = false
  11. elif axisX < 0:
  12. animatedSprite.animation = "run"
  13. animatedSprite.flip_h = true
  14. else:
  15. animatedSprite.animation = "idle"
  16.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement