Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Creative Greenfoot: RAW
  • Table Of Contents Toc
Creative Greenfoot: RAW

Creative Greenfoot: RAW

By : Haungs
4.7 (3)
close
close
Creative Greenfoot: RAW

Creative Greenfoot: RAW

4.7 (3)
By: Haungs

Overview of this book

This book is for coding students and Java programmers of all levels interested in building engaging, interactive applications with Greenfoot. Familiarity with the very basics of Greenfoot is assumed.
Table of Contents (12 chapters)
close
close
11
Index

Adding menus and buttons


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).

Figure 6: This is the new introduction screen we are adding to MazeWorld

This is how the game over screen will look.

Figure 7: This is the new game over screen we are adding to MazeWorld

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...
CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Creative Greenfoot: RAW
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon