Create HTML5 Vertical Endless Runner cross platform games

Using Phaser framework and other FREE software
Endless runner games are gaining more and more popularity and they are really easy to code.
I will take you by hand through the creation of a complete HTML5 vertical endless runner cross platform game with a lot of features and room for customization.
100 pages + 31 source code examples with a free update to come in a few days.

Using Tiled editor to create levels and import them as json data in your HTML5 swipe controlled Sokoban game made with Phaser

Emanuele Feronato Game design, HTML5, Javascript, Phaser

Apparently, the game I am about to show you now is the same you can see in the post HTML5 swipe controlled Sokoban game made with Phaser featuring unlimited undos – solving and advancing through levels and actually is the same game, or at least it works in the same way:

Swipe to move the player, double click/tap to undo last move.

The difference is this time I didn’t hardcode the levels but I created them with Tiled Map Editor. I really encourage you to use Tiled to design levels for your games, no matter if tile-based games like Sokoban or platformers, shooters and so on, as long as they are 2D games, even isometric.

Let’s see how to create and import levels made with Tiled into your game.

First, we create a new file, with these settings:

We are using a 8×8 tiles orthogonal map, where each tile will be a 40 pixels square. It’s not important the size of the tile, it’s just our Sokoban spritesheet has 40×40 assets and we will use the same spritesheet both for the game and for the editor.

Then it’s time to load a tileset, press “new tileset” and load the sokoban tiles. Be sure you are loading a 40×40 tileset, as this is the size you declared before.

And that’s it!! Your tiles have been loaded.

Now you can paint your first level, here it is:

Once you made your first level, create a new layer and proceed building the other levels. I am making only two levels but obviously there’s no limit.

This is my second level. Also noticed I gave each layer the level name. It’s not necessary, but as it’s part of the information you will export, keep in mind you can name your layers.

When it’s time to export the level, save it as a JSON file, I called it map.json and put it directly in game folder.

The exported file will look like this:

Now we are ready to load level information and build level array with a simple asynchronous request we are making in a preloader state. Here is the source code, with new lines highlighted. Check the previous step to see what changed.

Using a tool like Tiled will allow you to speed up level design process. Download the source code.

Stay up to date
Follow me on the social networks and never miss a post.

Official Emanuele Feronato Facebook page

Official Emanuele Feronato Twitter account

From null to full HTML5 cross platform game

I will take you by hand from the bare bones of JavaScript programming through the creation of a full cross platform HTML5 game, with detailed explainations and source code.

If you don't know where to start, then From null to full HTML5 cross platform game is the book for you.

Leave a Reply

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