Fix stuck walking key glitch

godot4-port
desktop 2020-12-11 22:54:40 +01:00
parent b07f1cadad
commit b6277954e5
1 changed files with 10 additions and 0 deletions

View File

@ -225,7 +225,17 @@ func spawn():
set_health(150)
velocity = Vector3()
walkDirection = Vector2.ZERO
# Fix bug when holding walking button when spawning
if Input.is_action_pressed("MoveForward"):
walkDirection.x += 1
if Input.is_action_pressed("MoveBack"):
walkDirection.x -= 1
if Input.is_action_pressed("MoveRight"):
walkDirection.y += 1
if Input.is_action_pressed("MoveLeft"):
walkDirection.y -= 1
game.get_spawn_point().spawn(self)