I, I’m new here and on godot too. My character doesn’t move when I press the button for no reason. I saw this in the tutorial of Gwizz on youtube, I’m on godot 4.7. Pls what can I do ?
extends CharacterBody2D
const SPEED = 300.0
var movedir = Vector2(0, 0)
func _physics_process(delta):
movement(delta)
func movement(d):
if Input.is_action_pressed(“left”):
movedir.x = 1
if Input.is_action_pressed(“right”):
movedir.x = -1
if Input.is_action_pressed(“jump”):
movedir.y = 1
if Input.is_action_pressed(“down”):
movedir.y = -1
if Input.is_action_pressed("left") and Input.is_action_pressed("right"):
movedir.x = 0
if Input.is_action_pressed("jump") and Input.is_action_pressed("down"):
movedir.y = 0
move_and_collide(movedir.normalized() * SPEED * d)