Editor’s note: This is part 2 of our simple Maze game series. We’ll continue to work on the maze game and you’ll learn how to interact with iPhone’s accelerometer.
In the first part of the maze game tutorial, we set up all the elements needed for the game and we wrote the code to animate the ghost characters. In the second part we are going to show you how to use the accelerometer for moving the pacman.
The iPhone’s built-in accelerometer has created tons of opportunities for iOS developers to create innovative and fun games. It is not uncommon you can find apps that allow user to control a game character by tilting an iPhone. And that’s what we’re going to do with our maze game. In this tutorial, we will give you a brief introduction of accelerometer, cover how to get access to the motion data by using the Core Motion framework and make the pacman move.
Let’s get started.