Posted April 08, 2025 by Mason Phillips
This update adds a working elevator platform to the game world! The elevator can be ridden up or down to access two different areas of the map, and it can also be called back from the other end of the elevator if it ends up on the side opposite the player. The elevator is also designed so that its start and end locations can easily be moved independently from one another, allowing the same elevator object to be customized to fit many different situations.
The elevator works using four different collision boxes which are triggered when the player character steps into them, split into two pairs with one pair at the top of the elevator and one at the bottom. In each pair, one is placed just in front of the elevator and is used to call the platform to that side of the elevator if the player finds themself at the end opposite of the platform. The other collision box in each pair is placed just above where the platform is and/or would be when it is at that side of the elevator so that the player touches it when standing on the platform, and this box triggers the platform to move to the opposite end of the elevator, carrying the player with it.
See attached images for screenshots of the blueprint programming that makes the elevator work. Here's a quick explanation of what the code does to make the elevator move:
1. Four different events exist at the far left, one for each collision box to detect when the player starts interacting with the elevator. Depending on which box the player touches, a delay may or may not be triggered
2. Next, a quick check on two boolean variables happens - first, is the platform moving? If not, the second variable is checked - is the platform at the bottom of the elevator? The fail case for each check depends on which box was triggered, but if both checks pass, they are both then inverted - the first one to update the location reference of the platform to be used the next time the elevator is triggered, and the second one to stop the elevator from being triggered again until the elevator stops moving at the end of the program
3. Then, a print string confirms to the player that the elevator has been triggered, before then moving on to a LERP function which, again depending on which box was triggered, will progress either forwards through the timeline or in reverse. This is how one single timeline can be used to move the platform from A - to - B, or from B - to - A with respect to where it is being triggered from.
4. Finally, when the LERP is finished and the platform reaches its destination, the isMoving variable is toggled so that the next time a collision box is triggered, the corresponding "is the platform moving" check in step two can once again pass, opening up the elevator to be called once again. This factor avoids weird conflicts that could otherwise happen if one box is triggered after another without giving enough time to let the elevator finish moving.