In this section, we will add an introduction screen and game over screen to MazeWorld
. We will add a button, textbox, and menu to the introduction screen (shown in Figure 6) and just a button to the game over screen (shown in Figure 7).
This is how the game over screen will look.
We created an introduction screen and game over screen in Chapter 1, Let's Dive Right in… and augmented the game over screen in Chapter 5, Interactive Application Design and Theory for Avoider Game, so the addition of these screens to MazeWorld will only be quickly covered here.
To start with, we are going to create a new class that both screens will inherit from. Create a new subclass of the World
class and name it, MazeWorldScreens
; don't associate an image with this class, and add the following code to it:
import greenfoot.*; public class MazeWorldScreens...