My movement code will not work so far can you help me

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Fusegene Studios

extends KinematicBody2D

var speed = 400
var velocity = Vector2()

func _ready():
pass

func _physics_process(delta):
velocity = Vector2()

if Input.is_action_pressed("down"):
	velocity.y -= speed
if Input.is_action_pressed("up"):
	velocity.y += speed



move_and_slide(velocity)

This code works for me with no errors. Can you describe what actually happens, and what you want to happen instead?

Cam | 2023-02-04 06:18

What do you mean by it does not work?

mautu | 2023-02-07 14:28