At Zeriab's encouragement *cough* I am making a tutorial out of my latest map developed under his watchful eye, a minigame where the player pushes/pulls boulders into position. Hopefully my eventing AND tute-writing skills will improve with time and experience... constructive feedback appreciated.
Boulder Minigame
by Shaz
IntroductionThe Boulder game requires the player to place boulders over sandy patches by pushing and/or pulling.
There may be more sandy patches than boulders (11 sandy patches and 7 boulders, specifically. In this case all boulders must be placed).
There may be more boulders than sandy patches (11 sandy patches and ... more than 11 boulders, not so specifically. In this case all sandy patches must be covered).
Correctly placed boulders will have a different appearance.
Screenshots EventingOn the first map, place a single NPC event with the following commands:
Fairly self-explanatory...
Variables 0001: BouldersToPlace and 0002: BouldersPlaced keep track of progress.
Variable 0004: Mode determines whether there will be more boulders or more sandy spots.
Current progress is reset, and instructions are given to the player, before transferring them to the REAL game.
Before starting on the second map, jump into the database and find your tileset.
Change the Terrain Tag on your sandy patch to something greater than 0.
(This is the first time I've had a need to play with terrain tags - I'm sure they can be used for much greater things, and I'm also sure there are other ways to do what I'm doing here). As the player moves boulders around, the terrain tag for the boulders' current location will be checked to see if it has been placed successfully. More on that later.
Now, on the second map, place your 11 sandy spots.
The boulders make use of common events, and a couple of self switches.
Self Switch A on each boulder is ON when the player makes the boulder move.
Self Switch B on each boulder is ON when the boulder is sitting on a sandy spot (it changes to black).
Let's set up the common events first. We'll have 4 of them: to move a boulder, to check the game's status, to set the appearance of a boulder, and to reset boulders back to their original state.
The easiest one is the Reset event:
We're just turning the Self Switches off.
This could easily have been done just on a new page for each event, but I've put it as a common event in case I ever want anything else to happen at this point.
Here's the SetGraphic common event:
Fairly simple - check the terrain tag the boulder is currently on.
If it's greater than 0, the boulder is on a sandy spot (we just set that up in the database).
So the graphic changes to a black boulder and Self Switch B is turned ON.
If it's NOT greater than 0, the graphic should be a brown boulder and Self Switch B is OFF.
Let's look at the CheckStatus common event, because it's a nice, simple one too:
Easy - compare how many boulders HAVE been placed with how many SHOULD be placed.
If all boulders are in position, show a message and send the player back to the previous map.
Note this event is set to autorun and has a conditioning switch.
Ok - there's no putting it off any longer... here's the meat of it - the MoveBoulder event:
First we call the common event to set the graphic - this just saves us an extra self switch and event page on each boulder event.
Next we see if the boulder is moving OFF a sandy spot - if it is, the BouldersPlaced figure needs to be adjusted.
Now we do the actual move. If the SHIFT button is being pressed (the A button in RMXP), the player wants to PULL the boulder, so first we have to move the player out of the way, then move the boulder one step towards the player. If the SHIFT button is NOT being pressed, the player wants to PUSH the boulder, so we just move the boulder one step away from the player.
After the move, we see if the boulder has ended up ON a sandy spot - if it has, the BouldersPlaced figure needs to be increased.
And then the boulder image is set again.
Finally we call the common event to see if the game is over (by turning on the conditioning switch), and set the event self switch A off since the boulder is no longer being moved.
There, now that wasn't so bad... *clears throat*
Ok. Before we look at the actual boulders, let's check a couple of housekeeping events on this map.
First, an event set to run as a parallel process, that simply waits 20 frames then turns off the Reset switch and does an erase event.
This just allows all the boulders time to reset themselves (so those placed in the last game don't show up as black at the start of the next game).
Second is an NPC event that just tells the player how many boulders they have to place (using \v[1]), and how many have been placed (using \v[2]), and gives the options to continue or return to the previous map.
Now the boulders - finally!
Create an event with the following 4 pages:
(this is so simple I'm not going to provide screen shots - if you feel they'll be useful say so and I'll add them in)
Ok. Pages 1 and 2 are simply the "wait" states for the boulder, which is either brown or black depending on Self Switch B.
Page 3 calls the MoveBoulder common event - since it's a parallel process, it allows other things to happen while it's doing its thing (in other words, the player can continue to move around - they don't have to wait for the boulder to finish moving before they can take another step!)
Page 4 calls the Reset common event to turn off all the self switches when the map first loads.
So - you've got your first boulder, now copy it and paste it around the map until you have 7.
These are the boulders that MUST be placed if you have more sandy spots than boulders.
None of the boulder events should be placed ON the sandy spots to begin with (unless you want the added
headache challenge of adjusting the PlacedBoulders variable and the boulder appearances at the start of the level)
Now, for the extra boulders that will appear if there are to be more boulders than sandy spots...
Make another copy of one of your boulders, and simply add the following precondition to each of the 4 event pages:
Variable [0001: BouldersToPlace] is 8 or above.
Now copy this boulder and paste it around - you want at least 4 of these new boulders, preferably more (so you end up with more than 11 boulders and have to cover all 11 sandy patches).
CreditsThanks to Zeriab for
- the idea for the game
- the additional request for pulling/pushing modes
- making me discover terrain tags
- asking what would happen if a boulder started on a sandy spot AND for not making me cater for that!
- the requirement for a placed boulder to have a different appearance (hey, wait - why am I thanking you for THAT? That was painful!)
Seriously - you're being very patient with me, and teaching me heaps! I hope I don't make you lose sleep...
From the AuthorThanks to all who read this tutorial.
I appreciate any constructive feedback.
I will try and answer any questions.
If you know of a better way to do any of this through eventing, feel free to say so.
Enjoy!
Shaz