Attention | Topic was automatically imported from the old Question2Answer platform. | |
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))