How to create an HTML5 RPG physics driven game with Phaser

The prototype is vaguely based on a game I played on my iPhone, One Tap RPG

I didn’t like the game that much but it has potential in my opinion, so I developed a little Phaser prototype powered by P2 Physics.

Click/tap anywhere on the screen to make the hero fall in the same x-coordinate of your tap. Collect coins, kill enemies by falling on their head – you will lose a life if you touch them and you aren’t over their head – level up and advance through floors. If you die, reload the game clicking here.

Although the game is simple, it covers some interesting features, such as:

* P2 physics
* Gravity and restitution
* Contact listeners
* Static and dynamic bodies

Here is the fully commented source code, really easy to understand and to improve:

How much gold will you get? Download the source code.

  • Nice!
    My work in progress take on the same idea:

  • The game looks very nice, and the code very clear. Thanks for sharing the code Emanuele, also your tutorials and tips are very good and helpful.