Move_and_slide is not declared

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

I’m new programing and I have this code but I get the error: Method move_and_slide is not declared in the current class.
How can I declare it?

func _move(delta):
	
	direction_x = int(Input.is_action_pressed("ui_right"))-int(Input.is_action_pressed("ui_left"))
	
	if direction_x < 0:
		$AnimatedSprite.flip_h = true
	elif direction_x >0:
		$AnimatedSprite.flip_h = false
	
	distance.x = speed*delta
	velocity.x = (direction_x*distance.x)/delta
	velocity.y += gravedad*delta
	
	move_and_slide(velocity, Vector2(0,-1))
:bust_in_silhouette: Reply From: kidscancode

move_and_slide() is a method of KinematicBody2D. You didn’t include your whole script (the extends line at the top, especially), but it appears to be the wrong type of node.