move_and_slide, what i do?

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

well, i dont know why but move_and_slide are wrong, anyone can help me?

code:

extends Node2D

const UP = Vector2(0,-1)
const BOOST = 200
const GRAVITY = 10

var motion = Vector2()

func _ready():
pass # Replace with function body.

func _physics_process(delta):
motion.y += GRAVITY

if Input.is_action_just_pressed("ui_accept"):
	motion.y =-BOOST
	
	motion = move_and_slide(motion,UP)
:bust_in_silhouette: Reply From: kidscancode

move_and_slide() is a method of KinematicBody2D. It does not work with Node2D, which your script extends.

More information: