Hello, I want my character to be idle when the keys are not pressed but I didn’t know how to set up the code for it. here’s my project: PlayCanvas | HTML5 Game Engine
Welcome to community ! @ZOE_BEATRIZ_NAVAT.
There are two ways that come to mind in your question.
First, Use if else-if else
If look at your update function, you are using serveral if
.
From the second if statement, fix it with an else-if statement, and add an else at the end to express the idle state.
Second, Using keyup
event.
When this event is triggered by a key release, you can transition to the idle state.