Video Game Design and Programming Concepts 48 Copyright Goodheart-Willcox Co., Inc. May not be reproduced or posted to a publicly accessible website. Cheat Code A cheat code is a shortcut built into a game to help the quality assurance team and programmers test the game. This allows them to jump past certain points without having to complete the task or level. To help you pass each level while testing your game, you will program a cheat code. The pseudocode is: IF the player presses the [space bar] on the keyboard, THEN stop the ball movement. 100. Display the event editor. Be sure Level 2 is current, as indicated by the drop-down list on the Navigate Toolbar. 101. Add a new condition. In the New Condition dialog box, right-click on the icon for The mouse pointer and keyboard, and click The keyboard Upon pressing a key in the shortcut menu. 102. When prompted for a key, press the [space bar]. 103. Right-click in the cell on line 4 below the icon for the Ball_Tennis object, and click Movement Stop in the shortcut menu. 104. Run the frame, and test the cheat code. Close the game window when done testing. Debugging Currently, you can only play one level at a time. You should be able to achieve the victory condition on Level 1 and continue on to Level 2, but this does not happen. This is a bug. A bug is an error in programming. In this case, the same programming from Level 1 to move to the next frame when the score is 10 is the bug. Level 1 moves to the next frame, but since the score is already 10, Level 2 instantly moves to the next level. As a result, you never see Level 2. 105. Open Level 2 in the event editor, as shown in Figure 3-12. 106. Examine the condition in line 2: IF the player 1 score equals 10. Double-click the condition to open the expression editor. Run Frame Event Editor Additional obstacles increase the difficulty Goodheart-Willcox Publisher Figure 3-11. Adding more obstacles is one way to increase the difficulty of a game level. Event Editor
Previous Page Next Page