0 votes

I downloaded the Godot 64 bit Standard version for Linux here.
The proceeded to follow a YouTube video "Godot 3.1: Creating a Simple 3D Game: Part 2 (Programming 101: Character Movement)" by BornCG.
Two hours into listening to Fred Rogers talking to me like a 12 year old, I cannot progress in his script.

extends Spatial

var velocity = Vector3(0,0,0)
const SPEED = 20 
func _ready():

func _physics_process(delta):
    if Input.is_action_pressed("ui_up"):
        velocity.z = -SPEED
   if Input.is_action_pressed("ui_down"):
        velocity.z = SPEED
    if Input.is_action_pressed("ui_left"):
        velocity.x = -SPEED
    if Input.is_action_pressed("ui_right"):
        velocity.x = SPEED

I cannot enter the last line and get the following message;
Error 18,1 the method "moveandslide" isn't declared in the current class.
Line 18 is red highlighted.

I have 36 years of programming experience, did someone forget to compile something or is BornCG coding too old and something new took it's place??

asked May 9 in Engine by Brian.Black (15 points)

1 Answer

+3 votes
Best answer

move_and_slide() is a method of KinematicBody. Your script says extends Spatial.

answered May 9 by kidscancode (17,762 points)
selected May 9 by Brian.Black

Thanks for your help. Apparently I missed a bit where he stated the root was the KinematicBody and not spatial. The man tends to meander about, making instructions longer than need be. I might not have missed that part, if he was more direct.

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 How to use this Q&A? before posting your first questions.