AchimS

Members
  • Content Count

    1
  • Joined

  • Last visited

  1. Hello everyone! I just recently got into PIXI.js and started with a tutorial from kittykatattack on GitHub which can be found here: https://github.com/kittykatattack/learningPixi#introduction I finished the tutorial and everything works great! After that I wanted to expand the game and add a "Try again" or "Play again" button to the end scene and I got that to work aswell. But each time the game restarts it gets quicker and quicker. It seems like the speed is doubling on each restart. I added this code to the end state function: tryAgainMessage.click; playAgainMessage.click; tryAgainMessage.click = function (e) { for (var i = stage.children.length - 1; i >= 0; i--) { stage.removeChild(stage.children[i]);}; gameScene.visible = true; gameOverScene.visible = false; state = setup; } playAgainMessage.click = function (e) { for (var i = stage.children.length - 1; i >= 0; i--) { stage.removeChild(stage.children[i]);}; gameScene.visible = true; gameOverScene.visible = false; state = setup; } Does anyone know how I can properly restart the game once the message is clicked?