Create a HTML5 game like Space is Key using Phaser, tweens and ARCADE physics – step 3: adding particles

Here we go with the 3rd step of “Space is Key” HTML5 prototype made using Phaser, tweens and ARCADE physics. In the first step we created the floors and make the player run and jump, then in step 2 we added deadly obstacles to be avoided as well as some level design concepts and now it’s time to show how to make the player die with a particle explosion if the square hits an obstacle.

This is what we are going to see today:

Click or tap to jump, avoid obstacles, see how you die when you hit an obstacle.

The completely commented source code is here, new lines added from step 2 are highlighted. If you followed previous steps, I moved some code in a function called placeSquare to place the square more easily when the player moves on to next floor or dies.

Would you like to see it turned into a mobile game? Next step I will show you how to do it, meanwhile download the source code.

  • Interesting program, I will visit your site often to learn how to make other games ;)

  • Diogo

    Shouldn’t line 218 be
    this.emitter.gravity.y = 200;
    instead of
    this.emitter.gravity = 200;