1var velocity = Vector2.ZERO
2
3func _physics_process(delta):
4 if Input. is_action_pressed("ui_right"):
5 position.x += 4
6 elif Input. is_action_pressed("ui_left"):
7 position.x -= 4
8 elif Input. is_action_pressed("ui_up"):
9 position.y -= 4
10 elif Input. is_action_pressed("ui_down"):
11 position.y += 4
12 move_and_collide(velocity * position)
13