Hi,
i am struggeling to get the Right animations for my Player.
i initialise the Player in create:
player = this.physics.add.sprite(90, 0, this.playerAtlas, "3");
player.setBounce(0.2).setScale(0.4);
player.setCollideWorldBounds(true);
player.anims.play(this.playerAtlas + "-run");
in update i add keylisteners and if Cursor up is pressend this methos will be executed:
jump(){
playerJumpAudio.play();
player.setVelocityY(-350);
player.anims.play(this.playerAtlas + "-jump");
player.setInteractive();
player.on("animationcomplete", () => {
player.anims.play(this.playerAtlas + "-run");
});
}
it works for the first time the Player jumps but after that i get following error:
phaser.js:114628 Uncaught RangeError: Maximum call stack size exceeded
at Animation.load (phaser.js:114628)
at Animation._startAnimation (phaser.js:114801)
at Animation.play (phaser.js:114748)
at ArcadeSprite.eval (eval at addToCache (phaser.js:171065), <anonymous>:784:17)
at ArcadeSprite.emit (phaser.js:1775)
at Animation.stop (phaser.js:115062)
at Animation.load (phaser.js:114632)
at Animation._startAnimation (phaser.js:114801)
at Animation.play (phaser.js:114748)
at ArcadeSprite.eval (eval at addToCache (phaser.js:171065), <anonymous>:784:17)
I estimate the Problem is, that two Animation are simultaneously played, but I don’t know how to get around the Problem.