HTML5 Totem Destroyer fully working prototype using Phaser

Emanuele Feronato Game design, HTML5, Javascript, Phaser

One of the frameworks I am using to release some HTML5 games is Phaser.

I already showed you how to include and use p2 physics with Phaser in the post quick HTML5 physics test with Phaser 2.0 and p2 physics, now it’s time to see something more complete and complex like a Totem Destroyer prototype.

If you are a long time reader, you should remember some old posts about this topic, like the AS3 full Totem Destroyer prototype and the complete HTML5 Totem destroyer engine using PhysicsJS.

Now it’s time to use Phaser to create the same thing.

By the end of this post, you will learn how to:

* Create static and dynamic bodies
* Attach images to bodies (actually is attach physics bodies to sprites)
* Destroy object with mouse click
* Handle collision listeners
* Use sensor bodies

Have a look at the result:

Click to destroy light-brown boxes, try to make the totem touch the ground or fly off the screen. Using sensors to detect when something is not on the screen is not the best practice available, but I needed a way to show you how to create sensors.

And this is the fully commented source code:

Phaser and p2 are a really explosive couple, stay tuned to see what I have for you next days, meanwhile you can download the entire project, images included.

Want to learn more? Learn by example!

Get the full commented source code of an actual commercial cross platform HTML5 game!!

Comments 2

Leave a Reply

Your email address will not be published. Required fields are marked *