Platform games have very distinct characteristics and Construct2 has a number of features to assist in building platform games.
Turn In: Platform2.capx
In this activity, we are going to build a platform game. Some of the game we build will be realistic and some of it will be included for learning and illustration purposes. Some options will be presented that you can choose how you want your game to work. You are welcome to try each of the options or just one of them.
Platform2.capx's layout should be 1600 by 480 and the the window size should be 640 by 480.
Platform games have two primary types of obstacles ... solid and jump-thru. The player is not able to go through any part of the solid obstacles. The jump-thru obstacles can be passed through from the bottom going up but when landing on them are solid and will hold the player.
Create a new sprite called Solid1 of size around 100 by 25, you can either make this obstacle one solid color or create the design of your choosing. Add the Solid behavior to this object.
Create a new sprite called Passthrough1 that is also 100 by 25 and a different color and/or design than Solid1. Add the Jump-thru behavior to this object.
Click on the Solid1 obstacle, hold your Ctrl key and drag the Solid1 object to another location. It should create a copy. Repeat that several times until you have 6 solid obstacles.
Click on the PassThrough1 obstacle, hold your Ctrl key and drag the PassThrough1 object to another location. It should create a copy. Repeat that several times until you have 5 pass through obstacles.
In a Platform game, the player moves left, right, jumps, and moves left/right while jumping.
Create a new sprite called Player1 of a size comparable to the obstacles and design of your choosing. Add both the Platform behavior and the Scroll To behavior to Player1.
Position the obstacles so the player will be able to move and jump between the obstacles. Position a few of the pass through obstacles so the player can jump from under them and pass up through them.
Run layout and use your arrow keys to go left, right, up arrow to jump, and combination of the up arrow with the left/right arrows. Have your player go off of the obstacles and notice that the player falls off the game board.
What do you want to happen when your player falls? Here are some options that you can try.
1. Put Player1 back in the game at a specific location. Add event, Player1->Is outside layout. Add action, Player1->Set Position then put in 200 for X and 200 for Y. On Layout 1, if you move your player around and watch the Position in the Properties on the left side, you will see where 200 by 200 is and can make sure there is an obstacle underneath that location.
2. Game over. Add event, Player1->Is outside layout. Add action to go the Game over layout.
3. Put a solid obstacle across the entire "floor" of the game so that the player always stays in the game.
4. Add the Wrap behavior so the player leaves the bottom of the game but wraps around and comes back into the game from the top.
5. Combination of two or more items above.
The Platform behavior for the player has a number of options. Click on Player1 and look at the Properties on the left hand side. Adjusting these values will alter the platform type of movements your player makes. For instance, change the jump strength from 650 to something higher if you want to the player to jump higher and lower the number to have the player not jump as high. If you click on one of the properties then a description appears at the bottom of the Properties window. Record the default values for the Properties then try different values, Run layout, and observe the results. Use the default values you wrote down to change the Properties back and try other changes.
We are going to create a second player to look at using non-default controls. If you would prefer to use touch instead of the keyboard for the second player, adjust the instructions accordingly.
Insert a new object onto Layout 1 and choose Keyboard (or Touch).
Add a new Sprite object onto Layout 1 and name the object Player2 then create/design a player of similar size to Player1. Add the Platform behavior and on the Properties for the Platfrom behavior of Player2 change the Default controls to No. Making this change allows us to control the player with something other than the arrow keys.
To move Player2, we are going to use the Z key to go left, the X key to go right, and the space bar to jump. Alternatively, you can create objects on the screen to move Player2 then simulate movement when those objects are touched. Adjust the instructions accordingly if you want to use touch instead of the keyboard to move Player2.
Add event then pick Keyboard, click Next, pick Key is down, click Next, click to choose the key then press Z, click Ok then click Done. Add action, choose Player2, click Next, select Simulate control, click Next, choose the Left control, click Done. Add event, Keyboard->X is down then Add action for Player2->Simulate control and pick Right. Add an event for the space bar pressed then simulate a jump.
Run layout and use the space bar to jump and the Z and X keys to move the second player around. If you did touch instead, touch the areas to move the player in the left/right/jump directions.
Additional Game Items
The intent of this activity was to introduce you to the key things in making a platform game. Platform games have a number of other items, below are some of those.
Methods to earn points including gathering objects, jumping on top of enemies, or navigating to specific areas of the game board. Conditions in which the player loses a life and in which the game is over. Multiple levels with ways to pass one level and move to the next level.
You can play and research platform games to see what other things you may want to include or you may have some ideas for your platform game that other game developers have not thought of or incorporated into other platform games.
Copyright © 2021 Eric Schumm. Permission granted to freely use this in your classroom.