Game Development Reference
In-Depth Information
The HelpScreen Classes
Next, let's implement the
HelpScreen
,
HighscoreScreen
, and
GameScreen
classes we used
previously in the
update()
method.
We defined three help screens in Chapter 3, each more or less explaining one aspect of the
game play. We now directly translate those to
Screen
implementations called
HelpScreen
,
HelpScreen2
, and
HelpScreen3
. They all have a single button that will initiate a screen transition.
The
HelpScreen3
screen will transition back to the
MainMenuScreen
. Figure
6-3
shows the three
help screens with the drawing coordinates and touch areas.
Figure 6-3.
The three help screens, drawing coordinates, and touch areas
Now that seems simple enough to implement. Let's start with the
HelpScreen
class, shown in
Listing 6-6.
Listing 6-6. HelpScreen.java; the First Help Screen
package
com.badlogic.androidgames.mrnom;
import
java.util.List;
import
com.badlogic.androidgames.framework.Game;
import
com.badlogic.androidgames.framework.Graphics;
import
com.badlogic.androidgames.framework.Input.TouchEvent;
import
com.badlogic.androidgames.framework.Screen;
public class
HelpScreen
extends
Screen {
public
HelpScreen(Game game) {
super
(game);
}