Do you like my tutorials?

Then consider supporting me on Ko-fi

Talking about Sokoban game, Construct, Game development and HTML5.

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

Never miss an update! Subscribe, and I will bother you by email only when a new game or full source code comes out.