Godot Version
4.6.2
Question
(New to Godot btw) So I’m trying to make code for moving left to right, but it won’t link correctly so that I can use move_and_slide.
This is the code in the tutorial:
This is my code:
If someone could figure out what I’m doing wrong here that would be greatly appreciated!
func _ready() -> void:
print("hello world")
wchc
2
The original script extends KinematicBody2D, while your script extends Sprite2D, which doesn’t have this function.
I suggest you to try the official Godot tutorial instead, it has all fresh information and it won’t leave you confused:
1 Like
You are trying to call move_and_slide for a Sprite2D instance. That class does not have a move_and_slide method.
The Character2D class does.
Move the code to your Player.
I also recommend you look at these projects: godotengine/godot-demo-projects: Demonstration and Template Projects