Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- func process_movement(delta):
- var motion = Vector2(0,0)
- if Input.is_action_pressed("move_up"):
- motion += Vector2(0, -1)
- set_rot(0)
- #print("up")
- if Input.is_action_pressed("move_down"):
- motion += Vector2(0, 1)
- set_rot(180)
- #print("down")
- if Input.is_action_pressed("move_right"):
- motion += Vector2(1, 0)
- set_rot(-90)
- #print("right")
- if Input.is_action_pressed("move_left"):
- motion += Vector2(-1, 0)
- set_rot(90)
- #print("left")
- motion = motion.normalized() * speed * delta
- move(motion)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement