15 Scenes
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 ...
Get Object-Oriented Python now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.