Can someone help me and tell me what is wrong with my code (i am a begginer)

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

extends AnimatableBody2D

var scroll_speed = 100
var move_vector = Vector2(-scroll_speed, 0)

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

func _process(delta):
move_and_slide(move_vector)

  1. AnimatableBody2D can’t do move_and_slide. Try using a CharacterBody2D instead

  2. The code you’re using is outdated, it’s for Godot 3.

The fix for the outdated code is instead of doing

move_and_slide(move_vector)

try doing

velocity = move_vector
move_and_slide()

I dont know tell me if that works or not because I haven’t tested it

OgGhostJelly | 2023-03-09 15:18