Game Development Reference
In-Depth Information
the image itself is called an image atlas (or texture atlas, or sprite sheet). Each
button has a size of 64 × 64 pixels, which will come in handy when we have to
decide whether a touch event has pressed a button on the screen.
help1.png , help2.png , and help3.png : These are the images we'll display on the
three help screens of Mr. Nom. They are all the same size, which makes placing
them on the screen easier.
logo.png : This is the logo we'll display on the main menu screen.
mainmenu.png : This contains the three options that we'll present to the player on
the main menu. Selecting one of these will trigger a transition to the respective
screen. Each option has a height of roughly 42 pixels, something we can use to
easily detect which option was touched.
ready.png , pause.png , and gameover.png : We'll draw these when the game is
about to be started, when it is paused, and when it is over.
numbers.png : This holds all the digits we'll need to render our high scores later
on. What to remember about this image is that each digit has the same width
and height, 20 × 32 pixels, except for the dot at the end, which is 10 × 32 pixels.
We can use this to render any number that is thrown at us.
tail.png : This is the tail of Mr. Nom, or rather one part of his tail. It's 32 × 32 pixels
in size.
headdown.png , headleft.png , headright.png , and headup.png : These images are
for the head of Mr. Nom; there's one for each direction in which he can move.
Because of his hat, we have to make these images a little bigger than the tail
image. Each head image is 42 × 42 pixels in size.
stain1.png , stain2.png , and stain3.png : These are the three types of stains
that we can render. Having three types will make the game screen a little more
diverse. They are 32 × 32 pixels in size, just like the tail image.
Great, now let's start implementing the screens!
Setting Up the Project
As mentioned in Chapter 5, we will merge the code for Mr. Nom with our framework code. All
the classes related to Mr. Nom will be placed in the package com.badlogic.androidgames.mrnom .
Additionally, we have to modify the manifest file, as outlined in Chapter 4. Our default activity will be
called MrNomGame . Just follow the eight steps outlined in the section “Android Game Project Setup
in Eight Easy Steps� in Chapter 4 to set the <activity > attributes properly (that is, so that the game
is fixed in portrait mode and configuration changes are handled by the application) and to give our
application the proper permissions (writing to external storage, using a wake lock, and so forth).
All the assets from the previous sections are located in the assets/ folder of the project.
Additionally, we have to put ic_launcher.png files into the res/drawable , res/drawable-ldpi ,
res/drawable-mdpi , res/drawable-hdpi , and res/drawable-xhdpi folders. We just took the
headright.png of Mr. Nom, renamed it ic_launcher.png , and put a properly resized version of it
in each of the folders.
 
Search WWH ::




Custom Search