Game Development Reference
In-Depth Information
Lastly, replace the call to the deleted renderTestObjects() method with the newly
added renderWorld() method in render() :
public void render () {
renderWorld(batch);
}
Now, the world renderer will call the renderWorld() method, which in turn calls
the render() method of Level to draw all the game objects of the loaded level.
Implementing the game GUI
In this last part of the chapter, we are going to implement the game's GUI and add it
to the scene. The GUI will display the achieved score, extra lives, and an FPS counter.
We will need to load a bitmap font before we are able to write any text output to the
screen. Fortunately, LibGDX provides a default font (Arial 15pt) that we can use.
Copy the two files arial-15.fnt and arial-15.png to CanyonBunny-android/
assets/images/ .
This is how LibGDX's default bitmap font looks:
You can also create your own fonts using Hiero , a font generator tool provided
by LibGDX. Check out the official project website https://github.com/
libgdx/libgdx/wiki/Hiero . There is also a popular commercial tool called
Glyph Designer , which is designed specifically for Mac. The official link is
https://71squared.com/en/glyphdesigner .
Add the following import line to Assets :
import com.badlogic.gdx.graphics.g2d.BitmapFont;
 
Search WWH ::




Custom Search