How to fix the warn

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

I’m trying to adjust the movement, but it gives a warning.

extends KinematicBody2D

var speed=1000

func _ready():
pass

func _process(_delta):

var velocity=Vector2()
if Input.is_action_pressed("up"):
	velocity.y -= speed
if Input.is_action_pressed("down"):
	velocity.y += speed
if Input.is_action_pressed("left"):
	velocity.x -= speed
if Input.is_action_pressed("right"):
	velocity.x += speed
move_and_slide(velocity,Vector2(0,-1))

What should I do?

You didn’t even say what the warning was.

kidscancode | 2022-10-29 19:14

My guess is move_and_slide returns a value that is unused

Wakatta | 2022-10-29 19:56

:bust_in_silhouette: Reply From: Wakatta

velocity = move_and_slide(velocity,Vector2(0,-1))