Join Joseph Labrecque for an in-depth discussion in this video Handling emitter collisions, part of HTML5 Game Development with Phaser.
- View Offline
…Collision detection is an important aspect of our game, and…phaser makes detecting object collisions very simple.…We'll be suing the phaser update method to check specific collisions against…entities within both our space rock group, and the emitter particles.…So inside of Game.js we'll scroll all the way down to the bottom.…And here we'll find our update function.…This is something that we created when we built out this state, but…we haven't actually done anything with it yet.…So let's add some collision detection.…
Upon update.…To do this, we'll use the physics arcade collision detection.…This is the physics system that we've been using throughout this game.…So if this.physics.arcade.overlap.…And there are a number of different things we need to feed into this function.…The first two are the two objects or…groups that we need to test for collisions against.…So the first will be this.spacerockgroup, and…the second is going to be our emitter so this.burst.…
Next we need to determine a function that's going to be called…
- 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