Book Image

Creative Greenfoot: RAW

By : Michael Haungs
Book Image

Creative Greenfoot: RAW

By: Michael Haungs

Overview of this book

Table of Contents (17 chapters)
Creative Greenfoot
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Chapter 8. User Interfaces

 

"If you can dream it, you can do it."

 
 --Walt Disney

Aside from user controls for games and simulations, you will, at times, want your user to click buttons, view text, and select items from menus. Imagine that you are creating a physics simulation and want to have your user set certain simulation parameters or that you have a store in your game where players can purchase upgrades. Or perhaps you want to create a dialogue between two actors in your scenario. In this chapter, we are going to explore techniques to provide various types of user interfaces (UIs). Specifically, we will look at the following topics:

  • Buttons and labels

  • Menus

  • Heads-up display (HUD)

Greenfoot provides little direct support to create user interfaces. There are only a few classes, such as Label and Counter, packaged with Greenfoot to help in this regard. So, we will have to build our own support. We will use Greenfoot Actors and the GreenfootImage class to create user interfaces and classes that...