How To Hack Your Jump System

This week the programmer who adjusted the jump system in Riptale talks about the process.

For gameplay fluency’s sake, we wanted to make it possible to perform a jump within a brief moment after passing a platform’s ledge and falling down. This can be done via a variety of methods, but the one we use goes as follows:

First, a method that detects whether you’re touching the ground, returns a boolean and stores it in a variable called e.g. “grounded”. Thus, whenever we read the variable “grounded” we know whether we’re touching the ground or not.

Next, we have a bool variable called “stillJumpable”. Whenever our player character is in grounded state, stepping over a ledge, and entering falling state, “stillJumpable” is set to “true”. During next frame, when the program reads player states and sees that we’ve entered falling state, it will check for “stillJumpable”. Since it will be true the first time it checks, we will now check if a timer or an alarm has been set, which it hasn’t by this point.

In GameMaker: Studio we’ve been using both GM:S’s alarms and manually crafted timers for different sorts of purposes. Here we’re using an alarm. Set the alarm for how long of a period of time after entering falling state you wish to be able to perform a jump. The alarm’s purpose is to turn “stillJumpable” to “false” after it has rang.

Right after the previous alarm check we have an if-statement check that asks for “stillJumpable” to be “true” and jump button to be pressed. If yes, then jump actions are performed and “stillJumpable” will be set to “false”.

This sort of optimizations are important, because they affect the feel of the game. It comes down to what players expect when they try to jump from a ledge. Without this method, it feels like the jump is disabled near the ledges when in fact the game is working perfectly fine.

Leave a Reply

Your email address will not be published. Required fields are marked *