Untitled

 avatar
unknown
plain_text
3 years ago
512 B
95
Indexable
extends KinematicBody2D
 
var speed = 200
 
var velocity = Vector2()
 
func _physics_process(_delta):
	velocity = Vector2(0,0)
	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
 
	velocity = velocity.normalized() * speed
	velocity = move_and_slide(velocity)
 
func _ready():
	pass # Replace with function body.
Editor is loading...