Gw Temp

Menu

Tutorial - 'Platform System: Jumping/Movement' by GameMaster

An item about RPGMaker 2000 posted on

Blurb

A well written tutorial about creating a platform system with running, and other forms of movement!

Body

Well, there is a common misconception that rm2k/3 cannot make a platform game. I am here to prove that wrong. In fact, rm2k/3 can make a platform almost as good as any other one. In this tutorial I am going to explain how to make a perfect movement system for one, and not just straight walking. Uphill, downhill, "gravity"... Not only that, but it is guaranteed lag free, because it is pretty much done with one event.

The tutorial shown is compatible with everything else you make for the platform. Meaning you could stick an A.I. system in there, whatever your heart desires, and it won't mess it up (unless you screw it up somehow.)

You may use the information in this tutorial how you please and change it how you like. All I would really like from you is a small mention in the credits. It could just be as simple as: Platform Base by GameMaster. Tis all I need, and I would appreciate a small token of gratitude for my hard work. Thank you.

---Pre-requisites:
In order to complete this I believe a person needs the following: good organization skills, the ability to read code really well, tons of patience, and knowledge of almost all commands of rm2k/3.

---To begin:
Go into the terrain tab in your database. You'll need to have at least 3. Each will have a name: 1=Unblocked, 2=Blocked, 3=Uphill.
Next, to the chipset tab. Using whatever chipset you want to use for the platform, mark every tile with the terrain numbers just created above. How? Click on the terrain button, then click on one of the terrains, then click on the tile, boom! It's now that kind of terrain.

Now, create a template map.

---First Event:
Create one event, make this event an autostart, stick inside this event one command, break loop. THAT'S IT! Nothing else. What does this do? It stops your movement from happening, but continues everything else. Don't ask me why this works...

---Movement Event:
Create a second event; make this event a parallel process.
Mark at the top, label #1. Followed by wait 0.0 seconds.
Make a new switch, called Hero Moving, then put a fork if that switch is ON, jump to label #1, with no else case.

Next, stick a key input process command into a variable called Movement. Uncheck the wait until key pressed, then check down, left, right, and up.

---Moving Left and Right:
Now, but a fork that if Movement equals right (should be 3), no else case.
Memorize position of hero into these variables= Hero X, Hero Y, Map ID.
Add 1 to X. Then, the command store terrain ID (into a variable called Terrain) of coordinates Hero X, and Hero Y.
Now, a fork if Terrain equals 3, Move event: Hero, switch Hero Moving ON, Move Up/Right, Switch Hero Moving OFF. Then, a jump to label #1.
After that fork, but another if Terrain does not equal 1, jump to label # 1.

Next, change variable hero Y, add 1 to it.
Store terrain ID (into variable Terrain) of coordinates Hero X, and Hero Y.
A fork, it Terrain does not equal 1 (with an else case). Inside, put: Move Event: Hero: Switch Hero Moving ON, move right, Switch Hero Moving OFF.
In the else case, put all this:
Move Event: Hero: Switch Hero Moving ON, move down/right, Switch Hero Moving OFF.

*Label #4
LOOP!
Wait 0.0 seconds
A switch, if hero moving is OFF, no else.
In this fork, put, Memorize Hero position (into the afore mentioned variables). Hero Y + 1.
Then, a store terrain, followed by a fork that if terrain does not equal 1, jump to label 1. At the end of that fork, move event: Hero: Switch Hero Moving ON, Move down, Switch Hero Moving OFF.

Thus ends the main fork in the loop, then the loop. Add a jump to label 1 at the end.
Here should be the end of the first fork in the whole movement process.

That was moving left, if you wanted to move right, change the Hero X +1 to Hero X -1, and when you get to putting in label #4, put jump to label #4 instead.

*---*There are the basics of left and right movement. If you fall off a cliff, you can't move left or right, if you want to move left and right while falling, read on, if not, skip to the jumping section.

Now, you want free movement in the air eh? Well, lucky for you, this is actually easy, just adding in two forks and a few other things. After Label 4, put this instead of the above:

LOOP!
Wait 0.0 seconds
A switch, if hero moving is OFF, no else.
In this fork, put, Memorize Hero position (into the afore mentioned variables). Hero Y + 1.
Then, a store terrain, followed by a fork that if terrain does not equal 1, jump to label 1.

Key input= Movement, check left and right only, don't check wait until pressed.
A fork, with else case, if Movement equals 3. In that fork put:
Hero X+1, Store terrain ID, It terrain = 1: move event: Hero: Switch Hero Moving ON, Move down/right, Switch Hero Moving OFF. Else that fork, move event: Hero: Switch Hero Moving ON, Move down, Switch Hero Moving OFF.

In the else case of the bigger fork, put another fork, this time if Movement equals 2, then put the same thing, only changing the X+1, to X-1, and making him move down left.
Then, in the else of that fork:
At the end of that fork, move event: Hero: Switch Hero Moving ON, Move down, Switch Hero Moving OFF.

Add a jump to label 1 at the end of the loop.
Here should be the end of the first fork in the whole movement process.

That was moving left, if you wanted to move right, change the Hero X +1 to Hero X -1, and when you get to putting in label #4, put jump to label #4 instead.


And that's all for the movement process.

---Jumping:
Jumping is a lot like moving. The only difference is the movement, and change Hero Y - 1 for up. The jumping system is totally up to you, if you want forced jump, it's easy, just like moving right and left. A totally free jump is also easy, basically follow the same rules for the second part of moving. To make it even easier, you can always jump to label 4 for the downfall, that's for all of you with free fall. You might come up with a code like this:

Now, but a fork that if Movement equals up (should be 1), no else case.

Key input= Movement, check left and right only, don't check wait until pressed.
A fork, with else case, if Movement equals 3. In that fork put:
Hero X+1, Store terrain ID, It terrain = 1: move event: Hero: Switch Hero Moving ON, Move up/right, Switch Hero Moving OFF. Else that fork, move event: Hero: Switch Hero Moving ON, Move up, Switch Hero Moving OFF.

In the else case of the bigger fork, put another fork, this time if Movement equals 2, then put the same thing, only changing the X+1, to X-1, and making him move up left.
Then, in the else of that fork:
At the end of that fork, move event: Hero: Switch Hero Moving ON, Move up, Switch Hero Moving OFF.

Then, add these commands:
Loop!
Wait 0.0 seconds
IF Switch Hero Moving is OFF
Break Loop
End
End Loop

Then, repeat for however high you want him to jump. I suggest three, followed by a jump to label #4. If you didn't make a free fall in label #4, go to the *---* section and follow that to add your jump fall.


And that is all for the movement. I hope you enjoyed it!