Tolland Middle School PTO



Platform Beginnings: An Idea With LegsDirections from the Game Maker’s Companion book by Jacob Habgood , Nana Nielsen and Martin RijksGame Description: You play the role of Fishpod: a sea creature whose life is threatened by the eruption of an underwater volcano. He is forced to flee the sulfurous, boiling waters that he once called home, for the relative safety of nearby caves. Unused to surviving on land, he must navigate his way through a series of perilous underground tunnels in order to find his way to a new home. To stay alive, he must learn how to make the most of his primitive limbs in order to avoid lava flows and poisonous pansies.The left and right arrow keys will move Fishpod horizontally and the spacebar makes him leap diagonally upward in the direction he is facing. Fishpod will stand, walk and jump on horizontal rock platforms, but will automatically fall down the screen when he is not supported by one. If Fishpod comes into contact with any of the hazards or goes off the edge of the screen, then he dies and is sent back to the beginning of the level.By the description, we will actually create 8 different Fishpod sprites accounting for stand, walk, jump and fall as well as left or right facing.The platforms and lava flows will require beginning, middle and end sprites made to the length required. So we will find 16 different sprite images for these. NOTE: We will begin by creating all the sprites needed and a simple test room to work with. When you get to the section on State machines, READ CAREFULLY!!!Sprites:Creating and Loading a new Sprite:Click the Create Sprite from the toolbar.Click the Load Sprite button and open the first sprite in the folder, sprite_gold_strip30.png.Click on the name field and call it sprite_gold.Click Center.Click OK.Repeat the process to create sprites for sprite_lava_begin, sprite_lava_end, sprite_lava_middle, sprite_pansy, sprite_pod_fall_left, sprite_pod_fall_right, sprite_pod_jump_left, sprite_pod_jump_right, sprite_pod_stand_left, sprite_pod_stand_right, sprite_pod_walk_left, sprite_pod_walk_right, sprite_rock_begin, sprite_rock_middle, sprite_rock_end.Collision MasksOne of the cool things about Game Maker’s sprites is that they have a Precise Collision Checking option, which performs pixel-perfect collision detection between different instances in your game. Every sprite created has this option enabled by default and you only get collision events when there is a visible overlap between two different instances in the game.When using Precise Collision Checking, sometimes it is not difficult to spot an error. An example would be when a character gets stuck walking or jumping onto the platform. That is because the collision masks are constantly changing to exactly match the pixels displayed in the animation frames of the character. Sometimes collisions can occur in one animation frame but go away in the next when the sprite changes. This can make the character get stuck, flip back and forth between sprites. There are also problems when the tiny bumps stop a character from walking across the platforms properly.Using Box-Based Collision checking, the collision points are calculated. This method produces a more solid and predictable playing experience. The result is better because all of the character sprites use an identical bounding box and there are no dips or bumps in the shaped to create unpredictable results.It is also worth noting that box-based collision is faster than precise collision detection because it is very easy to mathematically calculate when the 2 boxes overlap vs. comparing all pixels between two images. Box based collision is safer, faster and more reliable and is it important that we use it in this game as well as ensuring the dimensions of each box are the same for all the different sprites of the main character.Editing the Sprite Collision Masks:Reopen the sprite_pod_fall_left.Click the Modify Mask button.Under Image, make sure that the check is on Show Collision Mask.Under Shape, select Rectangle and under Bounding Box, choose Manual.Set the Bounding Box dimensions to Left 24, Right 40, Top 24, and Bottom 60.Repeat Steps 1-5 with the SAME VALUES for sprite_pod_fall_right, sprite_pod_jump_left, sprite-pod_jump_right, sprite_pod_stand_left, sprite_pod_stand_right, sprite_pod_walk_left, and sprite_pod_walk_right. All of these sprites must have the same bounding box dimensions.Repeat steps 1-5 for sprite_rock_middle using Left 0, Right 31, Top 5, and Bottom 20. This is a full-width platform sprite. The bounding box doesn’t include the top-most pixels of the rock so the character can have a small ov3erlap when standing on the rock. It also doesn’t include much of the spikey underside of the rock.Repeat steps 1-5 for the sprite_rock_begin using Left 16, Right 31, Top 5 and Bottom 20. This is a half-width platform. It needs the same top and bottom values to ensure smooth movements across them.Repeat steps 1-5 for sprite_rock_end using Left 0, Right 15, Top 5 and Bottom 20.The five remaining sprites (sprite_lava_begin, sprite_lava_middle, sprite_lava_end, sprite_gold, and sprite_pansy) can keep the Precision Collision Checking setting. Fishpod won’t physically react with them in the same way since they are hazards that instantly kill him or collectables that disappear on contact.The bounding box is much smaller that the size of the character but there are two reasons for this:Firstly, it only takes a horizontal overlap of 1 pixel to support Fishpod standing on the top of a platform. If the bounding box extended to the end of his flippers. then he could support himself on the flipper in an unrealistic way. With a smaller box, he must have a whole flipper in contact with the platform to stand.Secondly, there is nothing more annoying than what appears to be a random kill. If we used a larger bounding box, the collisions could occur when there are not actual overlapping pixels between the sprites. With a smaller bounding box, the center of the sprite is maintained and this helps prevent this from happening.SAVE your work OFTEN!!!Platform ObjectsYou cannot play a platform game without the platforms so we will get these made first. We will start with object_platform, the most important object in the game. It will have no sprite, actions or events since it will serve as the parent to all other platforms. We only create 3 different platform objects (object_rock_begin, object_rock_middle and object_rock_end) but most platform games would have many types of platforms so it is best to treat them as a group. By making object_platform the parent, we can test the collisions between it and Fishpod and know that if all is well for this platform, the others will work too.Creating the Parent Platform Object:Create an object and name it object_platform. Do not assign a sprite.Click ok to close the form.Creating the Rock Platform Objects:Create a new object and name it object_rock_middle.Assing the sprite sprite_rock_middle.Click the Parent field and assign object_platform.Click ok to close the form.Repeat steps 1-4 for object_rock_begin and object_rock_end using sprite_rock_begin and sprite_rock_end.Now we want to make it possible to create rock platforms of any length but we always begin with object_rock_begin and end with an object_rock_end. That makes positioning and repositioning platforms in the room a bith of the chore. So we will automate the process by making every object_rock_middle automatically create a beginning and ending platform where necessary. That way, we only worry about placing the object_rock_midle object in the room and the events take care of the rest.Adding a Create Event for the Rock Middle Object:Reopen the object_rock_middle.Click on Add Event and select Create.Click on the Control tab and drag Check Empty to the actions.In the Check Empty form, set X to 32 and Y to 0. Set Objects to ALL and make sure Relative is checked. Click OK.Select the Main1 tab and drag Change Instance to the actions. In the Change Instance chose object_rock_end. Set Perform Events to Yes.Repeat steps 3-5 setting X to -32 for object_rock_begin. Make sure to have a left Check Empty followed by a Change Instance for object_rock_begin. Set Perform Events to Yes.The order should read: Check Empty X=32 Change Instance object_rock_endCheck Empty X=-32Change Instance object_rock_beginClick OK to close the form.Creating a new Room with Platforms: Create a room.On the Settings tab, set the Width to 800 and Height to 600.On the Rooms toolbar, set Snap X and Snap Y to 32.Switch to the Objects tab and choose object_rock_middle. Add it anywhere in the room.Add multiple instances of object_rock_middle in the room. You need to put at least 2 platform instances together for the beginning and ending platforms to be added.Click the green check when the room is ready.Run the game and see that the platform is rounded off at either end. SAVE YOUR WORK NOW as fishpod1.gmkState MachinesState machines provide a way of breaking down large programming tasks into smaller chunks. They help you create programs that are easily understood and contain fewer bugs. We will use a state machine for our main character, Fishpod, since he has a number of states that will affect the way he behaves. The five states listed earlier are: standing, walking, jumping, falling and dying. Apart from these, the character has different behaviors in these states. The behaviors are as follows:Standing: motionless on the platform’s surface.Walking: horizontally moving across the platform’s surface.Jumping: moving diagonally under momentum and the influence of gravity.Falling: under the influence of gravity.Dying: under the influence of gravity and without collisions.Obviously it must be possible for Fishpod to change states as well but the conditions for doing so depend on his current state; so pressing the left arrow could change Fishpod into the walking state from standing but not from falling. Although we have shown 5 states in our state machine there are actually 10 in the game, since each state can be left or right facing. Rather than creating objects for each, we will use a variable to keep track of the direction the character is facing, using a value of 1 for left and 2 for right. Game Maker likes numbers and it makes it easy for the computer to process. State Objects:Now we will create the state objects for the Fishpod character. Each will be simple on its own but as a whole, they create a complex interactive object.Creating the Standing State Object and its Create Event:Create a new object called object_pod_standing. Use either the sprite_pod_stand_left or sprite_pod_stand_right. Set the Depth to -1 so it appears in front of other objects.Click the Add Event button and choose the Create Event.Drag the Move Fixed action from the Move tab. Select the Center box. Leave the Speed at 0. Click OK to close.Add a Set Gravity action (move tab) to the actions and leave the Direction and Gravity at 0. Gravity is off when the character enters the standing state.Include a Test Variable action (control tab). Use a variable called facing to record if the character is facing right or left. Type facing into Variable, FACE_RIGHT into Value and leave Operation set to equal to. If the character is facing right, it will perform the next action.Include a Change Sprite action (main1). Select the sprite_pod_standing_right sprite and leave the settings as they are.Include another Test Variable action (control). Type facing into Variable, FACE_LEFT into Value and leave Operation set to equal to. If the character is facing left, it will perform the next action.Include a Change Sprite action (main1). Select the sprite_pod_standing_left sprite and leave the settings as they are.You should now have 6 actions for your Create event.Creating the Remaining State objects:Create a new object called object_pod_walking. Choose either sprite_pod_walk_right or sprite_pod_walk_left. Set the Depth to -1.Create a new object called object_pod_jumping. Set its sprite to either sprite_pod_jump_right or sprite_pod_jump_left and set its Depth to -1.Create a new object called object_pod_falling. Set its sprite to either sprite_pod_fall_right or sprite_pod_fall_left and set its Depth to -1.Create a new object called object_pod_dying. Set its sprite to sprite_pod_jump_right or sprite_pod_jump_left and set its Depth to -1. The jump sprite shows Fishpod spinning so we will use this as the dying animation as he falls from the screen.We need to deal with two state transitions from walking and jumping. Walking will occur when the player presses the arrow keys and jumping when the player uses the space bar. These require 3 separate events: 2 Keyboard events for left and right arrow keys and a Key Press event for the space bar.Adding Key Events to the Standing State Object:Reopen the object_pod_standing.Click an Add Event and select Keyboard <Left> event. By using this, Fishpod will walk as long as the left arrow key is pressed.Include a Set Variable action (control). Type facing into Variable and FACE_LEFT into Value. This makes sure Fishpod is facing left when the left arrow key is used.Include a Change Instance action (main1). Select object_pod_walking from the Change Into menu and Yes to Perform Events. Repeat steps 2-4 using a Keyboard <Right> event and set facing to FACE_RIGHT instead.Click on the Add Event button and select a Key Press <Space> event. We use key press because we only want Fishpod to jump once each time the spacebar is pressed.Include a Change Instance action (main1). Select object_pod_jumping for the Change Into menu and Yes to Perform Events.Adding the Create Event for the Walking State Object:Reopen the object_pod_walking.Click the Add Event button and select Create event.Include a Test Variable action (control). Type facing into Variable and FACE_LEFT into Value and leave Operation set to equal to. This makes sure Fishpod is facing left when the left arrow key is used.Include a Start Block action (control). Include a Change Sprite (main1) and choose sprite_pod_walk_left. Leave the setting as they are.Include a Speed Horizontal action (move) and set Hor.Speed to -2.Include an End Block action (control).Repeat steps 3-7 testing for FACE_RIGHT, changing the sprite to sprite_pod_walk_right and setting Hor.Speed to 2.There should now be 10 actions in the Create event. Adding the Animation End Event to the Walking State Object:Click the Add Event button and choose Other, Animation End.Include a Change instance action (main1) that changes into object_pod_standing and select Yes for Perform Events.Creating a New Starting Object and its Create Event:Create a new object called object_pod. Choose any Fishpod sprite.Click on the Add Event button and choose the Create event.Include a Set Variable action (control). Type FACE_LEFT into Variable and 1 into Value. This makes sure Fishpod is facing left.Include a Set Variable action (control). Type FACE_RIGHT into Variable and 2 into Value. This makes sure Fishpod is facing left.Include a Set Variable action (control). Type facing into Variable and FACE_LEFT into Value. This makes sure Fishpod is facing left.Include a Change Instance action(main1). Select object_pod_standing form the Change Into menu and Yes to Perform Events. This puts the object into the standing state and never return it to the starting object again.Now reopen your test room and place an instance of object_pod somewhere in the room. Run the game and test that you can move Fishpod left or right using the arrow keys. If not, go back through the steps. Right now, he walks in the air and through platforms. Spacebar will cause Fishpod to endlessly spin and you have to quit the game to make him stop. We haven’t created a way to get him out of this jumping state yet.SAVE AS fishpod2.gmkCollisionProblem 1: Just Passing ThroughGames create the illusion of motion by drawing images at slightly different positions on the screen over time. In game Maker, these are called steps, with 30 steps equal to 1 second. So if Fishpod moves from the top of the screen to the bottom in 1 second, then Game Maker will have redrawn its sprite in 30 different positions during the journey. This is called discrete time sampling and impacts collision detection in a big way. When we add a collision event to Fishpod, Game Maker will perform a collision test in each position to see if it has collided with anything during the journey. When an object moves slowly, the bounding boxes overlap from one step to the next so collisions are detected continuously. If a sprite moves much faster, it creates gaps between the bounding boxes in each step. A collision is only called when two instances overlap during a step so it is not possible to create situations where Fishpod is above a platform and would appear to pass straight through the platform. If 2 instances are travelling toward each other at speed, then the chances of missing each other is way higher. So one problem to solve is making sure that moving instances don’t move so fast that they pass through each other.Problem 2: Get Your Insides OutAnother problem that results from discrete time sampling is collision detection involves instances not colliding at all in one step. They can have a large overlap by the time the collision event is triggered. the collision event may stop Fishpod moving but if the if the instances remain overlapping this way, the collision will continue to trigger at each step. We need to make sure that after instances collide, they finish touching but not overlapping. You can then move the sprites toward each other one pixel at a time until they reach the precise point of collision. Game Maker will do this for you but you need to understand the issue.Walk OnNow that we know a bit more about what is needed to achieve a collision event, we can start to handle the state transitions for our walking state object. This must include an event for handling collisions with platforms, as well as detecting whether the character is supported by a platform or not. We will begin by adding the collision event which needs to go back in time to the previous step and position Fishpod to the point of collision with the platform.Going back in time is not as impossible as it sounds. You may recall that every object has an X and Y variables that store the position of an instance in the room. Every object has an xprevious and yprevious variable that stores the previous position of an instance in the room. By setting x to xprevious and y to yprevous, we can move to the step before the collision happened. You can find the exact collision point by using the Move to Contact action. This action moves the instance in a given direction, 1 pixel at a time until the collision occurs. All objects have a direction variable which indicates the instance’s current movement direction. So we can use this in the Move to Contact action to make user we get the contact point with a colliding platform. Adding a Collision Event to the Walking State Object:Reopen object_pod_walking and add a Collision event with object-platform. Include a Set Variable action (control). Type x into the Variable and xprevious into the Value. Include another Set Variable action. Type y into the Variable and yprevious into the Value.Include a Move to Contact action (move). Type direction into Direction, leave Maximum to -1 and select all object for Against. This finds the contact point in the direction Fishpod is travelling. Maximum indicates the distance in pixels that the action will check for a collision before giving up. A -1 means it will check for collisions an arbitrary distance away.Include a Change Instance action (main1). Select object_pod_standing form the Change into and Yes for Perform Events.Keep this object open for the next set of coding directions.Adding a Step Event to the Walking State Object:Add a Step, Step event to object_pod_walking. We are using the Step event because the walking object is constantly moving and the ground could stop supporting it at any point,Include a Check Object action (control). Select object_platform for object, X is 0 and set Y to 1. Check both Relative and NOT. This checks to see if there would be a collision with the platform if Fishpod moved down 1 pixel and only performs if this is NOT true (if Fishpod is standing in the air).Include a Change Instance action (main1). Select object_pod_falling for the Change Into and Yes to Perform Events. This now make Fishpod fall is he is not on the platform.Click OK.Adding a Create Event for the Jumping State Object:Reopen object_pod_jumping and add a Create event.Include a Speed Vertical action (move) and type -24 into Vert.Speed. A negative vertical speed moves the character up the screen so this launches Fishpod in the air. Include a Set gravity action (move). Type 270 into Direction (downward) and 2 into Gravity. This tells Game Maker to increase the vertical speed by 2 every step as if being pulled down by gravity.Include a Test Variable action (control). Type facing into Variable, FACE_LEFT into Value and leave Operation to equal to. This checks the direction Fishpod is facing and will only perform the next actions if TRUE.Include a Start Block action (control). Include a Change Sprite action (main1) and choose sprite_pod_jump_left. Leave the other settings as they are.Include a Speed Horizontal action (move) and set the Hor.Speed to -6.Include an End Block action (control). Repeat steps 4-8 testing for FACE_RIGHT, changing to sprite_pod_jump_right, and setting the Hor.Speed to 6.Our collision event for the jumping state object is going to be similar to the collision event for the walking object. So we will copy it to save time. Wer use the direction variable as a parameter to the Move to Contact action so the actions we are copying automatically handle collisions in whatever direction Fishpod is travelling. We need to change the Change Instance from object_pod_standing to object_pod_falling. We will also add an action to bring the jumping Fishpod to a halt.Copying the Collision Event for the Jumping State Object:Reopen object_pod_walking and select the Collision event with object_platform.Right click anywhere in the actions list and choose Select All from the menu. Right click again to choose Copy.Reopen the object_pod_jumping and add a Collision with object_platform.Right click in the actions window and choose Paste. All 4 action from object_pod_walking are copied there.Drag the Move Fixed action (move) into the actions list before the Change Instance action. Select the middle Directions button and leave the Speed set to 0.Double click the Change Instance action to reopen it. Change the Change Into option to object_pod_falling.There are two situations in which a collision might occur. The first is when Fishpod jumps onto the platform’s surface and the second is when it collides with the underside of the platform. Both are handled with the Move to Contact action with the direction variable. You might expect the first situation to result in a change to object-pod_standing and the second to object-pod_falling. Once in the falling state, it will get back to the standing state within a couple of steps through its own state transitions.Finally we handle the Animation End event, which needs to switch from the rotating jumping animation to the static falling animation at the end of one full rotation.Adding an Animation End Event for the Jumping State Object:Add an Other, Animation End event to object_pod_jumping.Include a Change Instance action (main1) that changes into object_pod_falling and set Perform Events to YES.Falling DownThis is the only missing state behavior to be covered. It is not very complicated since it just needs to be affected by gravity. But, the Set Gravity action continues to increase the speed of an object indefinitely so we must be careful not to break our collision detection by making the object move too fast.Adding a Create Event to the Falling State Object:Reopen object-pod_falling and add a Create event.Include a Set Gravity action (move), setting Direction to 270 and Gravity to 2.Include a Test Variable action (control) and check that facing is equal to FACE_RIGHT.Include a Change Sprite action (main1) and select sprite_pod_fall_right. Leave all the settings alone.Include another Test Variable action (control) and check that facing is equal to FACE_LEFT.Include a Change Sprite action (main1) and select sprite_pod_falling_left. leave all settings alone.Next we will copy the collision event from the jumping state object, and implement the transition back into the standing state when Fishpod is supported by a platform. The Collision needs to check whether there is a platform beneath Fishpod’s feet (he might have fallen diagonally when making a jump).Copying a Collision Event for the Falling State Object:Reopen object_pod_jumping and select the Collision event with object_platform.Right click anywhere in the actions list and choose Select All from the menu. Right click again and choose Copy.Reopen object_pod_falling and add a Collision event with object_platform. Right click anywhere in the actions list and choose Paste from the menu. All 5 actions from object_pod_jumping are copied.Double click the Change Instance action in the actions list to reopen it. Change the Change Into option to object_pod_standing and set Perform Events to Yes.Include the Check Object action (control) directly above the Change Instance action. Set Object to object_platform, set Y to 1 and check Relative. This now switches the standing state if Fishpod is supported after colliding with the platform. This is important in the situation where Fishpod falls sideways into a platform as it makes no sense for him to change state when that happens.We will handle the problem of gravity making Fishpod fall too fast for the collision detection. We will do this in a Step event as this will constantly keep the speed in check.Adding a Step Event to the Falling State Object:Add a Step, Step event to the object-pod_falling object.Include a Test Variable action (control) and use it to check that vspeed is larger than 12.Include a Set Variable action (control) and use it to set vspeed to 12.Editing the Create Event of the Fishpod Object:Reopen the object_pod object and select the Create event. Edit the Change Instance action and set it to object_pod_falling.Run the game. It should allow you to walk along the platforms and jump between them. Try not to jump off the screen since we have no way to restart the level without stopping the game. SAVE as fishpod3.gmk.ChallengesNow that the platforms are in place and those mechanics work, we will add some challenges. We will start with some poisonous pansies and lava flows that send the player back to the beginning when Fishpod collides with them All of these objects need the same behavior so we will use a parent object called object_hazard to handle them all in the same collision event.It would be nice if our lava flows finished automatically in the same way as the rock platforms. So the instances of the middle lava object will turn into instances of the begin and end lava objects if no hazards are on either side of them. We will make begin and end lava objects add instances of platform object to finish them off if there is nothing there already.Creating Hazard Objects and Their Create Events:Create a new object called object_hazard and click OK.Create a new object called object_pansy. Assign sprite_pansy and set object_hazard as its Parent. Set Depth to -2 (in front of Fishpod so player can see a hazard clearly when colliding with it).Create a new object called object_lava_begin. Select sprite_lava-begin and set object_hazard as its Parent. Leave the Depth at 0 since lava hazards are part of a platform.Add a Create event to object_lava_begin.Include a Change Sprite action (main1) with Sprite set to sprite_lava_begin. Subimage =0 and Speed to 0.5. The lava animation will be slowed to half speed.Include a Check Empty action (control). Set X to -32, Objects to All and Relative.Include a Create Instance action (main1) that creates an instance of object_rock_begin. Set X to -32 and Relative.Create a new object called object_lava_end. Select sprite_lava_end and set object_hazard as its Parent.Add a Create event to object_lava_end.Include a Change Sprite action (main1) with Sprite set to sprite_lava_end, SubImage to 0 and Speed to 0.5.Include a Check Empty action (control). Set X to 32, Objects to all and Relative.Include a Create Instance action (main1) that creates an instance of object_rock_end. Set X to 32 and Relative.Creating the Middle Lava Object and Its Create EventCreate a new object called object_lava_middle. Assign the sprite_lava_middle and set object_hazard as its Parent.Add a Create event to object_lava_middle.Include a Change Sprite action (main1) with Sprite set to sprite_lava_middle, SubImage to 0 and Speed to 0.5.Include a Check Object action (control) with X set to 32 and check both Relative and NOT.Include a Start Block action (control).Include a Change Instance that changes into object_lava_end with Perform Events set to Yes.Include an Exit Event action (control).Include an End Block action.Include a Check Object action (control) with X set to -32 and Relative and NOT checked.Include a Start Block action.Include a Change Instance action that changes into object_lava_begins with Perform Events set to Yes.Include an Exit Event action.Include an End Block.That handles the automatic creation of the lava platforms. Now we need to make sure Fishpod restarts the level when coming into contact with a hazard or going off the end of the screen. To deal with all 4 Fishpod objects easily, we will make object_pod a parent of the 4 states and handle the one collision event between object_pod and object_hazard.Adding Inherited Events to the Fishpod Object:Open each of the states and assign object_pod as the parent: object_pod_standing, object_pod_walking, object_pod_jumping, object_pod_falling.Reopen object_pod and add a Collision event with object_hazard.Include a Change Instance action to change into object_pod_dying with Perform Events set to Yes.Add an Other, Outside Room eventInclude a Test Variable action and check that the y Variable is Larger Than 0. This means the action will only happen if Fishpod is lower than the top of the screen. Gravity will bring Fishpod down again if he jumps off the top of the screen.Include a Change Instance action to change into object_pod_dying with Perform Events set to Yes.Adding Behaviors for the Dying State Object: Reopen object_pod_dying and add a Create eventlInclude a Speed Vertical action (move) and set Vert. Speed to -15. This pushes Fishpod up in the air slightly before he is pulled down by gravity.Include a Set Gravity action. Type 270 for Direction and 2 for Gravity.Include a Test Variable action. Type facing into Variable, FACE_LEFT into Value and leave Operation set to equal to. Include a Change Sprite action and choose sprite_pod_jump_left.Repeat steps 4 and 5 for testing FACE_RIGHT and changing sprite to sprite_pod_jump_right.Add an Other, Outside Room event and include a Restart Room action without setting a Transition.GoalsWe won’t provide much of a challenge without a goal, so the final addition we will make is to include some gold nuggets that Fishpod must collect to complete the level. Once the nuggets are collected, the game will progress to the next room.Creating the Gold Object:Create a new object called object_gold and assign the gold sprite.Add a Create Event and include a Change Sprite action. Set Sprite to sprite_gold, SubImage to random(360) and Speed to 0.5.Reopen object_pod and add a Collision event with object_gold.Include a Destroy Instance action and choose Other. This destroys the gold.Include a Test Instance Count to check when the number of object_gold =0.Include a Next Room action and choose the Transition.Creating the Resource Group for Private Objects:Right click the objects folder and choose Create Group from the menu. Call it Private.Drag the following objects into the new folder: object_pod_standing, object_pod_walking, object_pod_jumping, object_pod_falling, object_pod_dying, object_rock_end, object_rock_begin, object_platform, object_hazard, object_lava_begin, and object_lava_end. The objects left outside this folder are: object_rock_middle, object_pod, object-pansy, object_lava_middle and object_gold.Create a few levels. Place object_rock_middle and object_lava_middle in lengths of 2 or more and the end will automatically be made. Be careful where you place the lava since it will kill Fishpod when he collides with it from above or below. Each level needs and instance of object_pod and at least one instance of object_gold. Include a final room with a congratulatory message spelled out using the gold instances as a final reward.Finishing TouchesWe are now going to add backgrounds and sound effects.Add the Finishing Touches:Choose Create Sound and load the 5 sound effects from the folder on the network.Reopen object_pod and add an Other, Game Start event. Include a Play Sound action for sound_thunder and set Loop to True.Select the Collision event with object_gold. At the start of the actions list, include a Play Sound action for sound_gold and leave Loop to False.Reopen object_pod_walking and select the Create event. At the start or end of the actions list, include a Play Sound for sound_walk and leave Loop to False.Reopen object-pod_jumping and select its Collision event with object_platform. At the start of the actions list, include a Play Sound action for sound_splash and leave Loop to False.Reopen object_pod_falling and select its Collision event with object_platform. At the start of the actions list, include a Play Sound action for sound_splash and leave Loop to False.Reopen object_pod_dying and select its Create event. At the start of the actions list, include a Play Sound action for sound_die and leave Loop to False.Use the Create Background button to create a background using background_cave.bmp from the folder on the network. Reopen each room and select the Backgrounds tab. Change <No Background> to background_cave.SAVE YOUR WORK!!! Save the game as fishpodcompleted.gmk. ................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download