
Willy Andres Diaz
PreguntaHola estoy trabajando con godot 4.0.1, este es mi código, pero cuando intento probarlo el nodo personaje no se mueve y luego se cierra el programa.
extends CharacterBody2D
var velocidad = 500
var movimiento = Vector2(0,0)
func get_inputs():
movimiento = Vector2()
if Input.is_action_pressed(“move right”):
movimiento.x += velocidad
if Input.is_action_pressed(“move left”):
movimiento.x -= velocidad
if Input.is_action_pressed(“move up”):
movimiento.y -= velocidad
if Input.is_action_pressed(“move down”):
movimiento.y += velocidad
func _physics_process(delta):
get_inputs()
velocidad = movimiento
move_and_slide()