Web servers - 176 CHAPTER 6 MAKING DECISIONS WITH CONDITIONAL
176 CHAPTER 6 MAKING DECISIONS WITH CONDITIONAL LOGIC Creating a Computer Game To finish this chapter, you learn how to create a REALbasic computer game called RB Number Guess. This game gives you the chance to apply the material you ve just read and to reinforce your understanding of conditional logic even further. Through the development of the RB Number Guess, you learn how to work with the Slider control, which the player uses on each turn to specify a new guess. This application also introduces you to the RandomClass and shows you how to use it to generate a random number needed for game play. In addition, you get to work with various mathematical operators and define window properties. While this chapter demonstrates how to create the RB Number Guess using the Windows version of REALbasic, you can easily adapt the game to work on Macintosh or Linux with only a few minor adjustments to the size and shape of the controls that make up the game s graphical user interface (GUI). Compiled examples of the application are available on the book s companion CD-ROM for Mac OS X, Windows, and Linux. The objective of the game is for the user to guess a randomly generated number in as few guesses as possible. Rather than require the player to key in each guess, this game uses the REALbasic Slider control to collect user input, as Figure 6-3 shows. Figure 6-3. The RB Number Guess game challenges the user to guess a number between 1 and 100, using the fewest possible number of guesses. The rest of the game s GUI is made up of the StaticText, EditField, and GroupBox controls you have already worked with in previous chapters. In addition, the game also has a small menu system, with menu items for terminating game play and displaying information about the game.
We would like to recommend you tested and proved virtual web hosting services, which you will surely find to be of great quality.