Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- extends Area2D
- export var Speed:int
- var velocity = Vector2()
- var screensize = Vector2 (480, 720)
- func get_input():
- velocity = Vector2()
- if Input.is_action_pressed ("ui_left"):
- velocity.x -= 1
- if Input.is_action_pressed ("ui_right"):
- velocity.x += 1
- if Input.is_action_pressed ("ui_up"):
- velocity.y -= 1
- if Input.is_action_pressed ("ui_down"):
- velocity.y += 1
- if velocity.length() > 0:
- velocity = velocity.normalized() * Speed
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement