Video Game Design and Programming Concepts 128 Copyright Goodheart-Willcox Co., Inc. May not be reproduced or posted to a publicly accessible website. 59. Applying what you have learned, set the Lower Speed, Higher Speed, Repeat, Back to, and Loop values for the direction node 16 (walking left) to the same as those used for the walking right animation 60. Click the OK button to close the image editor. 61. Run the frame to see how Spiko reacts to the game environment. Close the game window when done testing. Bug Repair Spiko fell right through the platforms! Remember, just because an object looks like a platform does not mean it will act like a platform. These objects need to be programmed to tell the computer they are solid objects and Spiko should not fall through them. 62. Open the Game Frame in event editor. 63. Program event line 1 to match this pseudocode: IF Spiko collides with the Platform 1 object, THEN Spiko’s movement will stop. 64. Program event line 2 to match this pseudocode: IF Spiko collides with the Platform 2 object, THEN Spiko’s movement will stop. 65. Run the frame to see if Spiko can walk on the platform without falling through it. Spiko should also fall through the hole in the platform. Close the game window when done testing. Platform Movement This game will have unlimited gameplay. That means that the game map will never end. To accomplish this, the platforms will have to move and respawn. The Heart objects should also move along with the platforms. By matching the upward motion settings of the platforms, the Heart objects will appear to be in the same position relative to the platforms. 66. Display the event editor for the Game Frame. 67. Applying what you have learned, program this pseudocode to move the platform up one pixel each time the game runs through the programming loop: IF always, THEN set the position of Platform 1 to (0, –1) relative to itself. 68. Program the Platform 2 object to match the movement of the Platform 1 object. Note: a new event line does not need to be added, as shown in Figure 10-11. 69. Run the frame. Notice how Spiko moves up with the platforms, but the hearts do not. Close the game window when done testing. 70. Applying what you have learned, program the movement of the hearts to match that of the platforms. 71. Test the frame, and debug if needed. Run Frame Event Editor Run Frame Event Editor Run Frame Add the second platform Goodheart-Willcox Publisher Figure 10-11. The programming to move the Platform 2 object can be combined with the programming for the Platform 1 object.
Previous Page Next Page