Está en la página 1de 1

extends Area2D

export (int) var velocidad


var movimiento = Vector2()

func _ready():
pass

func _process(delta):
movimiento = Vector2()
if Input.is_action_pressed("ui_right"):
movimiento.x +=1
if Input.is_action_pressed("ui_left"):
movimiento.x -=1
if Input.is_action_pressed("ui_down"):
movimiento.y += 1
if Input.is_action_pressed("ui_up"):
movimiento.y -= 1
if movimiento.length()>0:
movimiento = movimiento.normalized()*velocidad
position = movimiento*delta

También podría gustarte