Game Development Reference
In-Depth Information
The following is a list that defines the mapping between pixel colors and
game objects:
•
W
: This stands for white and is the starting position of the player
(spawn point)
•
P
: This stands for purple and represents the feather
•
Y
: This stands for yellow and represents the gold coin
•
G
: This stands for green and represents the rock
The black background represents empty spaces in the game world.
Create a subfolder in the
assets
folder named
levels
and copy the
level-01.png
level file into it. After this, add a new constant to the
Constants
class:
public class Constants {
// Visible game world is 5 meters wide
public static final float VIEWPORT_WIDTH = 5.0f;
// Visible game world is 5 meters tall
public static final float VIEWPORT_HEIGHT = 5.0f;
// Location of description file for texture atlas
public static final String TEXTURE_ATLAS_OBJECTS =
"images/canyonbunny.pack";
// Location of image file for level 01
public static final String LEVEL_01 = "levels/level-01.png";
}
This concludes our preparations for the game level. The loading of the level data will
be covered in the next chapter.