Game is only allowing player to jump once when space bar is clicked. It is defaulting back to idle.
Used Anim State Graph
Here is the editor link:
https://playcanvas.com/editor/project/1314410
Game is only allowing player to jump once when space bar is clicked. It is defaulting back to idle.
Used Anim State Graph
Here is the editor link:
https://playcanvas.com/editor/project/1314410
For the jump issue, your code checks for tags on the object the player collides with to change state
Player.prototype.onColllision = function (env) {
if (env.other.tags.has('Grounds')) {
this.state = 'run';
this.falling = false;
this.entity.anim.setBoolean('jump', false);
}
if (env.other.tags.has('Obstacles')) {
this.state = 'hit';
this.entity.anim.setTrigger('hit');
this.app.fire('GameManager:GameOver');
}
};
The physics entities in the scene don’t have these tags so the state is not changed from ‘jump’