Creation of an HTML5 game like Rise Above using Phaser and Arcade Physics – step 1

“The higher you rise, the more points you score”. This is the description of Rise Above iOS game in the App Store. Latest Norman Rozental game may seem “just another endless runner” but this one has been picked from Apple guys so it deserves some more attention.

It turns out the game is interesting to analyze and try to create using Phaser and Arcade Physics.

In this first step I divided the script in two sub-steps, one with the creation and the horizontal movement of the spaceship, and another adding barriers.

Just like all endless runners, the ship does not move, it’s the entire environment which moves towards the ship.

Adding and moving the ship

First, we’ll add the space ship, which will be moved with a tween. A little delay can also be set to have the player wait before the ship can be moved again, adding some more difficulty to the game, but it’s up to you.

This is what we are going to create:

Click on the canvas to move the space ship from one side to another, I added a 1/2 second delay which makes the gameplay ugly, just to show you how it works.

And this is the source code:

Play with shipHorizontalSpeed, shipMoveDelay and shipPositions to change the gameplay.

Now it’s time to add barriers.

Adding moving barriers and checking collisions

Barriers are created extending sprite class as seen in this post, and we only have to check for collisions between the ship and the group of barriers.

Click on the canvas to move the space ship from one side to another, try to avoid the barriers or the game will restart.

Here is the source code, with new lines highlighted:

And the basic game movement has been created. Next time I will show you how to make the ship rise and how to detect swipe to make it rising again, meanwhile download the source code.