Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- extends KinematicBody2D
- const SPEED = 210
- var dir = "down"
- var move = Vector2()
- func _ready():
- func _physics_process(delta):
- if Input_is_action_pressed("ui_up):
- move.y += SPEED
- dir = "up"
- elif Input.is_action_pressed("ui_down"):
- move.y -= SPEED
- dir = "down"
- else:
- move.y = 0
- if Input.is_action_pressed("ui_right"):
- move.x += SPEED
- dir = right
- elif Input.is_action_pressed("ui_left"):
- move.x -= SPEED
- dir = left
- move_and_slide()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement