Gw Temp


Article - 'Jump! Jump! Jump!' by Terin

An item about Game Design posted on Jan 14, 2004


Back by popular... Okay, so maybe not. An article about making characters jump in RPGMaker and GameMaker. Could be used for pretty much anything, but primarily for a top-down game.


I've seen a few questions about jumping in the forum lately, and my inspiration has been sparked again a tiny amount... Since people want to learn this, it's my job to give you what you want, and I present to you, "Jumping in a Game."

I've seen this primarily in RPGMaker 2000/2003 forums, (which I agree with DarkPriest, will probably be hazardous to your game... Platformer + RPGMaker == Bad) but there's also the chance of using this in GameMaker. There are a few questions you'll have to ask yourself first, as we would do in the Programmatic Process.

First off, are you going to allow air control and gravity to be realistic, or can characters jump into the air and move however they like, ten feet up? In reality, most people can't jump over one foot off of the Earth. When you look like you jump a lot, you're tucking your legs. Teaching Taekwondo, we know the secret to making the jump look high -- tuck those legs like there's no tomorrow! So, realistically, a jump would mean that you would jump in one direction and you wouldn't be able to adjust movement in air. You wouldn't also jump 8 feet up... 3 feet (with tucking legs) seems reasonable.

Air control is the ability to control yourself in the air. It's most notable from several First Person Shooters, such as Unreal Tournament, and others. Basically, if you jump with air control at 100%, you're able to control in the air if you want to suddenly move to your right, if you were jumping forward. In real life, you'd only go the direction you initially jumped, be it up, or forward. Last minute adjustments can be made, but only REALLY fast people ever can violate the air control rules.

So, now you should know your options. Now, think if it's even worth the trouble to put it in. Obviously, a sidescroller would need it, but does a top-down game really need it? Not really. It will use a LOT of events to do this in RPGMaker. GameMaker is much easier (just use the on-touching a certain tile command) to implement this in.

We'll need to start off by inputting a password or key from the keyboard. We need to see if a direction has been pressed. This will go into it's own variable, which we'll call, "Direction_Variable." We want to know if they're going in a specific direction, prior to their jump. This is pretty easy!

Now, we'll check after this if they press the key for jumping. If they do, then we'll use the "Direction_Variable" and make them move in that direction. If not, well, we don't have to worry about it, and the process starts over! You will probably want it to wait for another keystroke for about .3 seconds. Most humans can type keys within .3 seconds of eachother.

So what if they did hit the 'jump key?' Well, now's where we'll put in that air control, or not, depending on your preferences! If air control is in, you'll allow movement to continue while the character is in the air, and if not, movement will be ignored. If they hit the jump key, we'll need to turn on a switch (or set a Boolean Variable) called, "Jumping" to 1 or "On."

We'll wait for however long it takes for the movement to occur, and drop the character down to the ground again. But, here's where the fun part comes in. "How do I allow jumping to go through things?" In RPGMaker, you'll put in a slip-through to the movement. In GameMaker, if the character is "Jumping" the collision blocking should no longer be allowed to work.

In RPGMaker, a problem is that the character can jump into a cliff and just sit there because the slip-through command was called. Well, here's why I say, "RPGMaker is bad for this." You'll have to put an event on each of those possible tiles that forces the character to fall down. This is horribly annoying, and hostile. Another choice is to check the terrain id (check if it's mountain, etc) and then make them fall based off of that. Overall though, it's not a good idea.

For landing, the character should always have the "Jumping" Variable turned off. In addition, the character should stop 'slipping through' in RPGMaker, AND fall down based on gravity, should they be by a cliff. This is a long and strenuous process to get working the way you want it, so you'll have to play around.

So there you go. That's pretty much it. It's not really worth doing in a top-down game, to be completely honest. It's a better idea to do it in sidescrollers, but I'm not stopping you. Someone prove me wrong. *snigger*