January 2022
Beginner to intermediate
416 pages
10h 21m
English
Games and programs will often need to present different scenes to the user. For the purpose of this discussion, I’ll define a scene as any window layout and related user interactions that are significantly different from any other. For example, a game like Space Invaders may have a starting or splash scene, a main game play scene, a high scores scene, and perhaps an ending or goodbye scene.
In this chapter I will discuss two different approaches to writing a program that has multiple scenes. First, I’ll introduce the state machine technique, which works well for relatively small programs. Then I’ll show a fully object-oriented ...