Game Development Reference
In-Depth Information
We'll update this horizontal movement velocity each frame based on the current accelerometer
value on the x axis and combine it with Bob's vertical velocity, which is derived from the gravity
acceleration and his current vertical velocity, as we did for the cannonball in the Chapter 8
examples.
One essential aspect of the world is the portion we see of it. Since Bob will die when he leaves the
screen on the bottom edge, our camera also plays a role in the game mechanics. While we'll use a
camera for rendering and move it upward when Bob jumps, we won't use it in our world simulation
classes. Instead, we record Bob's highest y coordinate so far. If he's below that value minus half
the view frustum height, we know he has left the screen. Thus, we don't have a completely clean
separation between the model (our world simulation classes) and the view, since we need to know
the view frustum's height to determine whether Bob is dead. We can live with this.
Let's have a look at the assets we need.
Creating the Assets
Our new game has two types of graphical assets: UI elements and actual game, or world,
elements. Let's start with the UI elements.
The UI Elements
The first thing to notice is that the UI elements (buttons, logos, and so forth) do not depend on
our pixel-to-world unit mapping. As in Mr. Nom, we design them to fit a target resolution—in our
case, 320×480 pixels. Looking at Figure 9-2 , we can determine which UI elements we have.
The first UI elements we create are the buttons we need for the different screens. Figure 9-4
shows all the buttons of our game.
Figure 9-4. Various buttons, each 64×64 pixels in size
We prefer to create all graphical assets in a grid with cells having sizes of 32×32 or 64×64 pixels.
The buttons in Figure 9-4 are laid out in a grid with each cell having 64×64 pixels. The buttons
in the top row are used on the main menu screen to signal whether sound is enabled or not. The
arrow at the bottom left is used in a couple of screens to navigate to the next screen. The button
in the bottom right is used in the game screen when the game is running, to allow the user to
pause the game.
 
Search WWH ::




Custom Search