Character movement is not working, but there isn't any errors
Asked Answered
I

2

0

extends CharacterBody2D

func _physics_process(delta)
var direction = Input.get_vector("move_left", "move_right", "move_up", "move_down")
velocity = direction * 600
move_and_slide()

if velocity.length() > 0.0:
	$HappyBoo.play_walk_animation()
else:
	$HappyBoo.play_idle_animation()
Inoculum answered 7/3 at 19:59 Comment(0)
M
0

Did you define the input actions move_left, move_right, move_up and move_down?
https://docs.godotengine.org/en/4.2/getting_started/first_3d_game/02.player_input.html#creating-input-actions

If not, you can use the built-in actions:
var direction = Input.get_vector("ui_left", "ui_right", "ui_up", "ui_down")

Minuteman answered 7/3 at 20:40 Comment(0)
I
0

Thank you. It work perfectly

Inoculum answered 8/3 at 19:29 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.