Oh I see, I will post the code.
extends Area2D
export var speed = 400 # How fast the player will move (pixels/sec).
var screen_size # Size of the game window.
func ready():
screensize = getviewportrect().size
func process(delta):
var velocity = Vector2() # The player's movement vector.
if Input.isactionpressed("uiright"):
velocity.x += 1
if Input.isactionpressed("uileft"):
velocity.x -= 1
if Input.isactionpressed("uidown"):
velocity.y += 1
if Input.isactionpressed("ui_up"):
velocity.y -= 1
if velocity.length() > 0:
velocity = velocity.normalized() * speed
$AnimatedSprite.play()
else:
$AnimatedSprite.stop()
position += velocity * delta
position.x = clamp(position.x, 0, screensize.x)
position.y = clamp(position.y, 0, screensize.y)