top of page

GB Studio Tutorial - Disappearing Platforms

Hey everyone! This is going to be my first attempt at a tutorial for GB Studio. I haven't seen anyone else touch on this topic, so I thought I would give it a shot. I don't have time to do a step-by-step tutorial, but I'll show you how I do it in The Fallen Crown. I'm a relative newbie here, so bear with me:


For The Fallen Crown's prototype, I've been using version 2.5, so that's what we'll be using here. The basics should be about the same, but version 3.0 has 'on enter' and 'on leave' behaviors on triggers, so that would simplify the process.


Essentially, I have an empty actor pinned to the bottom right of the screen that I use as a 'controller'. When the leftmost tall trigger is well, triggered, that turns on a variable that starts the 'on update' script on the controller. The controller will alternate between two variables, one for each platform. The 'In' variable being true means the platform is pushed back, letting the player fall. 'Out' being true will of course mean the player is able to stand on it, keeping the player aloft. Each platform will also have it's own background palette that visually corresponds with those positions(I won't cover this here, but I can if there seems to be a demand for it).

If the player lands on the platform trigger while the platform is 'In', it moves the player down 2 spaces on the Y axis with the 'Move Relative' command(make sure the 'use collisions' box is NOT checked), which causes the player to fall aaaaaaaaallll the way down.


Ideally, this would be the end of the tutorial. However, if the player lands safely while the platform is 'Out' and stays put while the platform goes 'In', they will NOT fall. We can't have that. Now it gets complicated.


First, we have to add the 'on platform' variable that will tell the 'control' if the player is currently standing on the platform or not. Then we have to add a check on the 'control' that will drop the player if the player is standing still on a platform during the change.

I've highlighted the script on the platform triggers, as you can see. This basically checks to see if the platform is out when the player lands on it. If it is out, that sets the 'on platform' variable to true so the game knows which platform the player is on. And of course, if it's not true, it moves the player below the platform and lets gravity do the rest.

You'll see on the right in orange where this check is. Right after the 'In' and 'Out' variables change, I added an 'if variable is true' check. This says if the player is on platform during the change, it will also move the player down past the platform. Unfortunately, this is where we hit a bit of a snag. For me, with this version of GB Studio, I can't use the 'controller' to also use 'move relative' on the player. He wigs out and gets stuck in the middle of the platform and loses control until he eventually falls down. So I've had to use 'set relative position' on the player instead. This causes a brief flash of black for a few frames. I haven't currently found a better workaround, but it's better than not working at all. I hope this won't be an issue in 3.0, but if I make any progress on this issue, I'll be sure to update this tutorial.


The triggers above the platforms turn 'Off' the respective 'On Platform' variable (this will be an unnecessary step in 3.0, you should be able to put this in the 'on leave' part of the trigger). This is so when landing on the next platform, the game won't think the player is on both platforms at once. This video kind of breaks these down in a way that hopefully makes all these steps a bit easier to digest.


And that's about it, I think. Be sure to let me know if anything is unclear, and anything I could do differently in the future. I don't think I'll ever have time to do a from scratch, step-by-step video with project files to download. But if I ever have the means to do so, and the demand is there, I would love to do it that way. I'd love to hear your feedback, and please tell your friends about The Fallen Crown. Thanks!


-Larson

bottom of page