extends Area2D
export (int) var SPEED
var velocity = Vector2()
var screensize
func _ready():
screensize = get_viewport_rect().size
func _process(delta):
velocity = Vector2()
if Input.is_action_pressed("ui_right"):
velocity.x += 1
if Input.is_action_pressed("ui_left"):
velocity.x -= 1
if Input.is_action_pressed("ui_down"):
velocity.y += 1
if Input.is_action_pressed("ui_up"):
velocity.y -= 1
if velocity.length() > 0: # normalizing = 1
21. velocity = velocity.normalized() SPEED
velocity = velocity.normalized() SPEED
position += velocity * delta
pass
Invalid operands 'Vector2' and 'Nil' in operator '*'.
Error in line 21.