Advertisement
scolain

Godot TDS Player move

Jan 12th, 2023 (edited)
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | Source Code | 0 0
  1. # ---- 1ER COPIER-COLLER ----
  2. extends KinematicBody2D
  3.  
  4. var move_speed = 500
  5. var motion = Vector2()
  6.  
  7. var bullet_speed = 1000
  8. var bullet = preload("res://Bullet.tscn")
  9.  
  10. func _ready():
  11. pass # Replace with function body.
  12.  
  13.  
  14. func _physics_process(_delta):
  15. motion.x = Input.get_action_strength("right") - Input.get_action_strength("left")
  16. motion.y = Input.get_action_strength("down") - Input.get_action_strength("up")
  17.  
  18. motion = motion.normalized()
  19. motion = move_and_slide(motion * move_speed)
  20.  
  21.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement