Elevator Going up!?
The last article went over moving platforms and the player lives system.
This article will over talking about setting up an Interactable, and having that interactable call something. In this case an elevator panel interacting and calling an elevator.
So an interactable can come in many different shapes and forms. One instance as an example would be automatic sliding doors. If we take the area where the sensor notices a person as the trigger area, then it opens the doors. That is a style of interactable. Another would be a hold interaction: hold X for a few seconds and have it charge a battery in something. The style that I went with is closer to the latter of the two examples here, but rather than a hold on the interactable, it’s set as a single press for things to activate.
On the elevator getting called, it inverses which way it is going. So if it’s (going down) it’s true, and if it’s going up it’ll be false. So on pressing the elevator panel it inverses the bool. The way it moves is similar to the moving platform. It moves toward points set as the destinations and ping pongs between them using the panel as an activator rather than automatically. The on trigger enter and exit are the same as the moving platform as well, it’s there to help for a smooth ride on the elevator.
With that a small update on the 2.5D platformer. Next is wall jumping and pushing boxes. On to the next!