Wide rivers and deep canyons can add a lot to a map’s appearance, but for players they often serve as impassable barriers. So why don’t we take a look at how we can make some rafts and platforms to help our players get the most out of our maps?
For our first moving platform, let’s keep things pretty simple. It will only move when the player steps on it, and can only move left-and-right or up-and-down.
For this event, let’s use one of the default B tiles to make a raft. Using a tile as the event’s image has the added bonus of giving the event the tile’s passability, so by using a bridge tile we can control which directions the player can approach the event from. We also want to make sure the event’s Speed is set to ‘4: Normal’ so that it will move at the same speed as the player.
The event’s content itself can be split into three parts: getting the player onto the raft, moving, and getting the player off the raft. Getting the player onto the raft is pretty straightforward, we need to make sure that the player’s walking animation is Off so that they stand still as the raft moves and set both the event and the player to through On so they can properly cross the water. The only tricky part of the setup is making sure that the event is facing the right way. By default, events with tile images face Down on a map, so we need to use the script call this.setDirection($gamePlayer.direction()) in the event’s move route so that it will move in the same direction as the player.
The moving part of the event is where we need to make some design decisions. How should we tell the event that it has moved far enough? There are a few options, but for this tutorial let’s use regions to mark the stop points. When the raft’s event moves onto region 1, then it should stop moving forward and the last part of the event should run. We can easily check the event’s current region using the Get Location Info command. To make sure our event and player keep moving forward if they aren’t on region 1, let’s put their move routes into a loop that only breaks if the raft event is on region 1. So both the event and player take 1 step forward, the event’s current region is checked, and then either the loop is broken or the whole thing repeats until region 1 is reached.
Now, you could skip the loop and just have the player and raft’s move routes set to the right number of step forward commands to cross the water, but there’s one big issue with that: you have to edit the move routes if you change the map or just want to copy-paste the event somewhere else. For an event that’s used once or twice that may be fine, but why give your future self extra work when you can do it with a loop and regions?
And to wrap up the event, we need to have the player get off the raft, which is mostly reversing what we did at the start of this event. So we want to turn the player’s walking animation back On, set through to Off for the event and player, and have the player take 1 step forward so that they’re no longer on the event.
Our raft is ready, but can’t do anything until we set up our map. So let’s get our river ready and put our rafts into the water so that our player can make it from one side to the other.
And now that we know where our raft events are and where they should go, we can add Region 1 to each edge of the river our rafts can reach.
With the event and map finished, we just need to playtest and make sure that it works how we want. If you only have the main character show up on the map, things should work perfectly well. But if you have followers On while you playtest, you may notice an issue...
If you use the above event when you have visible followers, your poor followers are stuck swimming behind you!
That’s probably not what you want to happen. So we need to tweak the first and last parts of the event to take our followers into account. We can start with another raft event, though this time we’ll be putting the contents into a common event so we can just call it whenever we need to make a platform.
The first new change we need to make is to add the Gather Followers command and turn the followers Off while we’re getting the player onto the raft. That way they won’t be dragged along through the water while the event and player are moving.
Once the player has reached the other side of the river, we can think about turning the followers back On. But if we do that without using the Gather Followers command again, the followers will appear right back in the water! So we need to gather them all again, and then make them visible so they’ll appear properly on the stopped raft.
If we playtest this new event, we should see our followers are no longer getting wet every time our players try to cross the river.
Rafts are useful events, but what if our game takes place in a sci-fi world where platforms can move on their own? The event’s contents will be pretty similar to what we’ve already made, but the autonomous movement will all be done by the event itself.
Since we’ll be using the same type of setup as above, we can create our map and put down region 1 where we’ll need it.
To add a bit of extra movement to the events, this time let’s use a sprite as the image. Our event will need two pages to work, the first page for when it’s moving on its own and the second page for when the player can step onto it. The event will use its autonomous move routes to switch between the two pages so that to the player it looks like the event moves on its own.
The first page needs to have the Through option checked so that the event can safely travel across the impassible pit.
The first page’s move route simply has the event take 1 step forward and then uses a conditional branch in a script call to see if the event is on region 1.
The script call checks if the event’s region (using this.regionId() ) is 1 and if it is then it turns the event’s self-switch A On and has the event turn 180° so that it’s facing the opposite direction.
if (this.regionId() == 1) {$gameSelfSwitches.setValue([$gameMap._mapId, this.eventId(), 'A'], true); this.turn180();}
The event needs to be turned around at this point because if we have the second page control the turning around, there’s a possibility of the player leaving the map while self-switch A is still On… That doesn’t seem like a huge issue, but if the second page is active and tells the event to turn around before the self-switch is turned Off, where is the event going to go? Right off the path you wanted.
The event’s second page is where the event pauses to let the player interact with it, so its Through option is Off and its contents call a common event. Since this event is using a sprite instead of a tile as the image, we need to use a slightly different common event to make sure our player stands on the event when moving (we’ll touch on the changes in a moment).
This page’s move route is even simpler, with just a 1-second wait and a script call.
The script call is $gameSelfSwitches.setValue([$gameMap._mapId, this.eventId(), 'A'], false) so that self-switch A is turned Off and the event’s first page can play again.
With the event’s two pages ready, we can go tweak the common event we’ll be using. The moving and getting off the event parts remain the same as before, but we need to change the start of the event. Since this event’s priority is set to Same as characters, our player doesn’t step onto it to activate the event. So we need to add in a 1 step forward to the end of our player’s move route in the first part of the common event to move them onto the event. Then we can gather and hide the followers, and play the rest of the event like we have before.
And with that, we have functional moving platforms!
Where would you consider using moving platforms in your game?