Preview:
extends CharacterBody2D


var speed : float = 100

func _physics_process(delta: float) -> void:
	velocity.x = 0
	velocity.y = 0
	
	if Input.is_key_pressed(KEY_RIGHT):
		velocity.x += speed
		
	if Input.is_key_pressed(KEY_LEFT):
		velocity.x -= speed	
		
	if Input.is_key_pressed(KEY_UP):
		velocity.y -= speed	
		
	if Input.is_key_pressed(KEY_DOWN):
		velocity.y += speed	
	
	move_and_slide()
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter