Launch a 2048-type game on iOS using Swift
2048 Swift is a sliding puzzle game inspired by the top selling game 2048.
Like the original, it features two Game Modes, Classic and TimeTrial, automatic game save and best score sharing with Game Center and Facebook/Twitter. The source code is very customizable and easily extendable.
It's written in Swift, the brand new Apple programming language just released with iOS 8.
What is 2048
2048 is played on a simple gray 4×4 grid, with numbered tiles that slide smoothly when a player moves them using the four arrow keys. Every turn, a new tile will randomly appear in an empty spot on the board with a value of either 2 or 4.
Tiles slide as far as possible in the chosen direction until they are stopped by either another tile or the edge of the grid. If two tiles of the same number collide while moving, they will merge into a tile with the total value of the two tiles that collided. The resulting tile cannot merge with another tile again in the same move.
A scoreboard on the upper-right keeps track of the user's score. The user's score starts at zero, and is incremented whenever two tiles combine, by the value of the new tile. As with many arcade games, the user's best score is shown alongside the current score.
The game is won when a tile with a value of 2048 appears on the board, hence the name of the game. After reaching the target score, players can continue in a sandbox mode that continues beyond 2048. The maximum possible tile is 131,072 (or 217); the maximum possible score is 3,932,100; the maximum number of moves is 131,038. When the player has no legal moves (there are no empty spaces and no adjacent tiles with the same value), the game ends.