In this topic, we will learn how to display the game score and save the high score. We will also see how to use custom fonts to display text on the screen.
We want to keep track of how many times the user has collected the ball and show it to him. So, we add a new variable to the
GameManager class called
public static int score;
Let's initialize it to
0 in the
To display the score, we are going to add a new class called
TextManager to the
com.packtpub.catchtheball.managers package, similar to what we did previously:
package com.packtpub.catchtheball.managers; import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.g2d.BitmapFont; import ...