During my work as a freelance developer I had very few opportunities to work on video game projects. Normally these were utility applications of various kinds. In 2013, while I was engaged at Reply Live as a mobile iOS developer, I was asked to create a mini-game based on the famous Fifteen puzzle consisting of 15 numbered tiles, scattered in random order within a 4×4 board, which the player had rearrange in the order from 1 to 15, moving one tile at a time.
It was a happy little corner that I managed to carve out for a short time. In spite of this, this experience served as a push to take on a new path.
At the same time, while searching for components and libraries to re-use in our projects, I met the CodeCanyon site. So I had the idea of trying to monetize some of my pieces of code.
Unfortunately I could not reuse the same code written for the company, but I rewrote it from scratch. After all, it was a relatively simple task.
So I created a complete mini-game, supplying all the source code that other developers could customize and eventually publish on the store in its own name. The project was accepted and is still present on the site.
Everything was developed in Objective-C using the standard iOS SDK without additional libraries, and consists of two simple screens.
The first is shown at startup and is simply an introductory view that allows the user access to the game by pressing the appropriate “Start!” button.
The game screen contains the board with an initially random tile configuration. To make the game more interesting, the background of each tile shows a section of a larger image. Consequently, reordering the tiles the player can see clearly the whole image that has been chosen.
In the same screen there are also three buttons:
- Solve, to automatically rearrange the tiles to the expected order
- Scramble, to generate a new random arrangement for the tiles
- Exit, to return to the introductory screen.
The developer who wants to customize this application has several tools available programmatically. He can:
- Decide the board’s size in terms of pixels, but also the number of rows and columns
- Set a background image of the board
- Choose the image that is spitted between tiles
- Add a shadow to the board
- Customize the number labels on each tile, their font and color
- Use callbacks for every game event (Board solved, tile touches, tile swipes and others) to add extra contents and effects to the game.