0 votes

I am getting this error:Invalid call. Nonexistent function 'moveandslide' in base 'KinematicBody2D (KinematicBody2D.gd)'.

**I don't know why... I am following a tutorial and it is LITERALLY the exact same and he didn't get an error. Can you tell me what's wrong with my script and how to fix it? Here's the link to the video https://www.youtube.com/watch?v=Viaslrr1Md4**

Here's my script:

extends KinematicBody2D

Laws of Physics

const GRAVITY = Vector2(0, 500)

Movement Contants

const FLOORNORMAL = Vector2(0, -1)
const SLOPE
const JUMP
FORCE = 200

Player Variables

var velocity = Vector2()
var can_jump = false


func ready():


func fixedprocess(delta):
#Add Gravity
velocity += GRAVITY * delta


#Move and Slide
velocity = move_and_slide(velocity, FLOOR_NORMAL, SLOPE_FRICTION)
# Movement
var movement = 0

    movement -= 1

    movement += 1

movement *= MOVEMENT_SPEED

# Change horizontal veloctiy
velocity.x = lerp(velocity.x, movement, ACCELERATION)

#Input: Jump
if(can_jump && Input.is_action_pressed("ui_up")):
    velocity.y -= JUMP_FORCE
    can_jump = false
in Engine by (21 points)

1 Answer

+1 vote


  1. What version are you using? The latest stable release is 2.1.3, and
    he is using an alpha build for 2.2. Where did you get the function
    for move_and_slide? This Function does not exist in Godot (At least
    the 2.1.3 stable). (Hence the Nonexistent function part.)

    From what I can tell, you are using the wrong version. Of Godot.
    Here's what the man in the tutorial recommend using. WARNING IT'S IN
    ALPHA! https://archive.hugo.pro/godot/

  2. If you wish to use Godot 2.1.3 Then use the move() function and if
    your character sticks to stuff use is_colliding() and
    get_collision_normal to slide your character.

    Here's an example /It's from one of my projects so it probably doesn't work with your code./:

        var motion = velocity * delta
        #Slide player if colliding
        if is_colliding():
            normal = get_collision_normal()
            motion = normal.slide(motion)
            velocity = normal.slide(velocity)
by (272 points)
edited by
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.