Game Development Reference
In-Depth Information
// Draw Clouds
clouds.render(batch);
}
This will finally draw all the elements of a loaded level to create the scene for the
game world. The order of the draw calls is important because every subsequent draw
call is drawing on top of the scene. The drawing order can be imagined as layers,
although there is no real depth or z axis like in 3D space.
Nevertheless, if someone were to look at the example scene that is shown at the
beginning of this chapter from a 45 degree angled view, it might look like this:
All objects that are drawn first will appear further in the background. Thus, the
mountains are further away than the rocks or the stretched water overlay.
Assembling the game world
We will now remove some of the old code that was used to draw test sprites.
Additionally, we will add three new constants to define the amount of player lives
and the viewport dimension of the GUI camera.
Change the code of the Constants class as follows:
public class Constants {
// Visible game world is 5 meters wide
public static final float VIEWPORT_WIDTH = 5.0f;
 
Search WWH ::




Custom Search