Create an HTML5 Sokoban game using new Construct2 tilemaps only

You know I love Sokoban game. You should be able to do a Sokoban in every programming language you know in less than a day, as I told some time ago in this post.

Recently, I released a free iOS game I invite you all to download called BWBan, and the whole process of the creation of the game is explained in this post.

Recently, Construct2 supported Tilemap objects, so it means you can draw your level with a tool like Tiled and import it in your game layout simply dragging and dropping the .tmx file in the layout window.

So, this is how you can add a little interaction and create a tile based game like Sokoban just using the new Tilemap object.

First, you need the tiles, so create the tileset with some drawing software, that’s what I made: from left to right and top to bottom, we have respectively the tiles representing the floor, the wall, the crate target, the crate, the player, the crate on a target, the player on a target and two empty tiles we won’t use in the game.

At this time it’s easy to use the tileset into Tiled and create your own level. Using Tiled is beyond the scope of this post, anyway it’s really easy.

Once you’re done, save the .tmx file

Now you just have to drag and drop such file into your Construct2 layout, and you’ll have a Tilemap object ready to be used.

Construct also provides an exhaustive set of functions to manage, create, manipolate and destroy tiles, so creating a game once you know the logic (which is explained in my jQuery version), so here it the set of actions to do:

And this is the result:

Control the game with arrow keys

Obviously, you can download the full project

  • Jose M.

    Emanuel thanks for all your tutorials they are of great help. In the case of Sokoban using construct 2, how would you check and/or let the player know that they completed a level?

  • Emanuele Feronato

    You completed a level when there isn’t any tartetTile on the stage

  • Lucas

    How to show a message that the level is completed?

    thanks,