In this series, we will go through designing and programming a sliding puzzle game for iOS with Objective-C.
This tutorial assumes that you have some basic understanding of programming in general and perhaps some familiarity with XCode and Objective-C. If you don't know any programming, you might find this tutorial a little difficult to follow. The entire programming should take you no longer than 4 hours and I have included all the assets for you, so you can easily and efficiently follow my steps. The course in general should not take you longer than 4 hours to finish.
What I try in each of the videos is to focus on one topic and simplify that as much as possible. So good luck in following these series and if you had any questions, you can always get in touch with me. I usually manage to reply within 12 hours.
Happy coding and have fun.
The most important thing in developing any app is to understand how the app actually functions. Once we understood that, we need to come up with a plan to breakdown the pieces and make a functioning path way to develop our app.
In a nutshell, we need the following things to develop our app:
1) We first need a view where we can chose the type of the game we wish to play.
2) Then we need to have a main game view, that is where the game is presented and can be played.
3) We then need to have an action that reads our images and makes image view blocks from them
4) After that, we will have to randomize our blocks and make sure there is an empty spot. We also need to remember where this empty spot is.
5) We then need a touch system that understands which block has been tapped on and finds out if the tapped image view is adjacent to an empty spot.
6) We also need to program a timer action to count down the time of the game.
7) We finally need a navigation system to move back and forth to the main page.
For this game, I have provided you with a set of assets, they are mainly different images, their samples and icons as well as a logo for our game.
In this lesson, we will design our main game view. I am currently designing it to be use on an iPhone device but you could very well use the same logic on an iPad.
We will also add a sample to our game. It will work as a visual guide. We should add a timer and a back button. This is the button that allows us to go back to the main menu. We will make the main menu later.
In this lesson, we will add our images to our project and start building a grid of image views using these images. Because it's very important to remember where each block is located, we are also going to remember the center that we assign to each Image Views.
In this lesson, we will randomize the location of our blocks and also we delete one block from the set making sure that game is actually playable.
In here, we will use the Touch Ended action to understand every time used taps on the images. We will then run a logic to understand if the tapped on image is adjacent to an empty spot.
In here, we will implement the code for the timer action. It will be called once every second and will subtract a one from the current remaining time.
In this lesson, we add the buttons of the various menu items to our main menu and write the code to make sure we make the correct transition.
In this lesson, we will program the features of the main menu buttons.
Here, we make sure the game returns to its main menu if player can't mange to finish it within the allocated time.
I am currently Senior Instructor at Cinard. Before taking up this job and moving to beautiful Vancouver, for over a decade I was senior lecturer of apps / games programming in various colleges and universities.
I work primarily in native iOS and Android apps and Video games in Unity3D.
Cinard is a Digital Media Art & Technology Institute.