HTML5 Particle System Tutorial


Many games feature various effects such as explosions, smoke plumes, weather effects such as rain, snow and so on. Booty5 is equipped with a specific actor type that can generate particles called a ParticleActor. The ParticleActor can generate a range of different types of particles systems for you, or you can use it to generate custom particle systems manually.

This tutorial teaches you how to create a particle explosion using the generateExplosion() method of the ParticleActor object.

  1. Lets begin by creating a new Booty5 HTML5 project by clicking the New button in the main menu
  2. Now select the gamescene in the world tree then select the OnTapped handler box that is located in the scenes property panel to the right
  3. Enter “CreateParticles(this);” into the OnTapped box
  4. Now select the Common.js script in the world tree to view the default script that was created for you when you created the project
  5. Enter the following code into the script file and then save your project

The above code will be called by the scene whenever the user taps on the screen, generating a particle explosion at the position at which the user touched the screen.

Finally, click the Test button to run the project.

You can view the finished project for this tutorial here.

You can download the complete finished project for this tutorial here.

Related topics:

2,050 total views, 1 views today