| Platform Jumping Tutorial | ||||||||||||||
| This tutorial teaches you to make a platform game using character sets and allows for full control of the jump unlike most other tutorials. |
||||||||||||||
| What you will use: | ||||||||||||||
| 1 switch -jumping 3 variables -hero x -hero y -key press |
||||||||||||||
| Okay, we start off by editing the chipset being used to our liking. To do so simply change the panorama chip on the first page to passable and set any event you want to be able to walk on to not passable. Draw out a simple map comprised mostly of panorama and a small level of non passable terrain as the platform. Once you are done with that set up a start party position one space above the non passable terrain and get ready for some really simple coding. Now create a new event, called gravity. Make it have no graphic and set it to on hero touch. Have it move by route and enter the route like so. start slip through, move toward hero, end slip through. In the event commands box enter a move hero command. set it to, move hero down, ignored if can't be moved. There now you have step one done. On to the jumping part now. Create a new event called Jump controls and set it to no graphic and parallel process. leave it on stay still however. In the event command box enter the following coding. Enter Password: var[001:Key Press] If Var(001:Key Press)4 <>Change Var: Var[002:Hero X] set to hero x position <>Change Var: Var[003:Hero Y] set to hero y position <>Change Var: Var[003:Hero Y] (-)-3 <>Change Switch: Var[001:Jumping] Switch ON <> :End Case Now this probably won't make much sense now, but this is what initiates the jump and determines most of it. Anyways, create a second page in the event and have it activated if the jumping switch is on. Make it another parallel process and have it blank and stay still. In this one enter the following coding. Wait 0.1s Enter Password: var[001: Key Press] If Var(001: Key Press)4 <> :Else Case <>If Var(001: Key Press)3 <> :Else Case <>If Var(001: Key Press)2 <> :Else Case <>Move Event: Hero-(insert a lot of hero downs here followed by landing sound effect) check ignored <>Move All <>Change Switch: Var[001:Jumping] Switch OFF <> Okay, this particular event will cause the hero to land if the player doesn't have up, left, or right pressed in the keyboard. At the moment the hero will not be able to move due to the first event, gravity, that we created. I suppose it is time to change it so that he can. Go back to the gravity event and create a new page in it activated by the jumping switch. Keep the same route as before only make this event a parallel process and enter the following coding. <>Wait 0.6s (this determines how long you can stay in the air, you may edit this how you like) <>Move Event: Hero-(insert a lot of hero downs here followed by landing sound effect) check ignored <>Move All <>Change Switch: Var[001:Jumping] Switch OFF <> There, now your hero can jump freely for however long the wait is set at...but wait, how come he can jump as high as he wants? Time to make one last event. Create an event called jump blocker and set it to activated by switch, once again keep it at stay still and without a graphic. make it a parallel process and enter the following bit of coding. Make sure to keep it as same level as hero. <>Wait 0.0s <>Change Var: Var[002:Hero X] set to hero x position <>Teleport Event: This Event-(set the teleport to by variable and set it to the hero's x and y coordinates) Now we have all of the coding done. The final event teleports itself 3 spaces above the hero's head until you land. That way it can prevent the infinite jumping. Hopefully you enjoyed this tutorial, and if you decide to use it...give credit where it's due. |
||||||||||||||
| Note: I did not add any change character graphics for simplicity's sake however, you can add them inside the move hero down parts before the sound effect and during the jumping switch on events if you would like |
||||||||||||||
| BACK TO TUTORIALS | ||||||||||||||