Join Joseph Labrecque for an in-depth discussion in this video Particles and emitters, part of HTML5 Game Development with Phaser.
- View Offline
We have all of the basic elements of our game in place.…A game world, a set of bunnies which hop around the screen, and…a number of space rocks which are hurtling toward the poor creatures.…It is the player's job to defend these creatures from the approaching cataclysm.…We will do this by allowing the player to cause defensive explosions through click…or touch input.…So the first thing we need to do is actually pre-load the image that will be…used for our particles.…To do this we go to preloader.js and inside of our preload function…we'll say this.load.image and for an identifier we'll…call this explosion and the image we'll use is located at images/explosion.ping.…
All right, moving back into game js and immediately under where we declare…space group, we're going to declare something new called this.first.…This is going to be our emitter.…It's going to emit different particles based on that explosion image we…just created.…Inside the buildWorld, let's invoke a, new function called this.buildEmitter.…For buildEmitter itself I've copied some code, from the snippets.…
- Downloading the Phaser framework
- Creating your first Phaser project
- Building the preloader and menu states
- Creating and spawning entities
- Working with particles and emitters
- Detecting and handling collisions
- Detecting "game over"
- Adding sound effects and text
- Preparing for mobile deployment