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/
.
Note
The Libgdx font files can be downloaded on Packt's website at: http://www.packtpub.com/learning-libgdx-game-development/book
This is how Libgdx's default bitmap font looks:

Add the following import line to Assets
:
import com.badlogic.gdx.graphics.g2d.BitmapFont;
Add the following lines of code to Assets
as follows:
public AssetFonts fonts; public class AssetFonts { public final BitmapFont defaultSmall; public final BitmapFont defaultNormal; public final BitmapFont defaultBig; public AssetFonts () { // create three...