HTML5 game engine behind “Mike Dangers” made in a few lines of code with Phaser and ARCADE physics

Did you play Mike Dangers by Henrique Silva? It’s also available on Google Play.

It’s an endless climber heavily influenced by old Commodore 64 glory Rick Dangerous.

mikedanger

All you have to do is climb your way to the sky, ladder after ladder, avoiding spikes, traps and monsters while collecting diamonds and idols.

Playing a bit with Phaser and ARCADE physics, I was able to replicate the main engine, as you can see from this prototype:

Just tap or click to make the player jump. Try to climb the ladders. If you have a mobile device, you can play directly at this link.

Despite the few lines of code – a bit more than 150 – I was able to add these features:

* Fake endless runner feeling. You aren’t “climbing”, I just tween the game then reposition it. Remember endless runners aren’t actually “endless”, I wrote an entire book about it.

* Object Pooling collection to use only a few sprites and only two tweens. If you aren’t familiar with object pooling, check this post.

* ARCADE physics managemetn and collision handling

* Eight different variables to play with to adjust gameplay

This is why Phaser is so awesome.

This is the source code of the first prototype, I have to add diamonds and enemies, then the game will be uploaded with line by line comments both here and on Learn Lazer. Anyway, the code is very simple and split into functions:

Next time I’ll add diamonds and enemies, meanwhile download the source code.