Character movement

Godot Version

Godot 4

Question

I’m new to Godot and I want to make it so that as soon as the scene starts my character walks to the right. I’ve already consulted chatGPT but it didn’t help at all.

if you could tell me what I’ve done wrong, it would help a lot

extends CharacterBody2D

var velh: float = 300.0

func _ready():
velocity = Vector2(velh, 0)

func _physics_process(delta):
move_and_slide()

Stop consulting with ChatGPT and watch one of hundreds videos about basic movement.
Really, stop using ChatGPT. if you like read, just read documentation, it also have article about movement 2D movement overview — Godot Engine (stable) documentation in English

2 Likes

provide screenshot of whole screen