Complete HTML5 Totem destroyer engine using PhysicsJS

Back home and finally with a good internet connection, I am blogging again after the longest “no post” period in the story of the blog.

We are about to see a full Totem destroyer engine made using PhysicsJS, a new interesting javascript physics engine I reviewed in this post.

The engine has very nice features such as an intuitive way to create and skin bodies and a smart collision detection, but I’m finding it a bit unstable with stacked bodies, as you are about to see, because it feels a bit trembling.

Anyway, this is the totem destroyer prototype, featuring:

* Static (or “fixed”, as the engine calls them) and dynamic bodies
* Custom images applied to bodies
* Mouse interaction
* Collision detection

You should know how to play it: remove bricks by clicking on them and don’t let the totem hit the ground (anyway, make it fall to see what happens). Darker bricks cannot be removed.

As said, it looks a bit trembling, at least with 0.5.4 version. One idea would be making all bodies fixed until the first brick is removed, but I hope future versions will fix this issue without any workaround.

Here is the fully commented source code:

And of course you can download the entire project with all required files.

Nice to meet you again!

  • Malloky

    You are amazing Emanuel, God bless you

  • molano

    @emanuele

    good one, i just wanna ask you which tool do you prefer to skin a game?
    i mean fonts and graphics?

    regards…