![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | User457654654 |
Hello, everyone.
I am fairly new here. I copied and pasted this code from the documentation…
`extends KinematicBody2D
export (int) var speed = 200
var velocity = Vector2()
func get_input():
velocity = Vector2()
if Input.is_action_pressed(‘right’):
velocity.x += 1
if Input.is_action_pressed(‘left’):
velocity.x -= 1
if Input.is_action_pressed(‘down’):
velocity.y += 1
if Input.is_action_pressed(‘up’):
velocity.y -= 1
velocity = velocity.normalized() * speed
func _physics_process(delta):
get_input()
move_and_slide(velocity)`
… And then, I got two error messages. I’ve read that the types of warnings I’ve received were more like warnings. To fix one, I simply had to add an underscore before delta, but I still can’t get rid of this error.
“The function ‘move_and_slide()’ returns a value, but this value is never used.”
Can anyone please tell me how to fix this?