Game Development Reference
In-Depth Information
Don't forget to switch the event trigger to Player Touch; otherwise, the player will have to press spacebar or Enter
to activate the event. Set the destination to one square south of the exit on MAP001. (You can left-click the map list
within the Transfer Player menu to change which map you are looking at.) If you have followed the topic up to now,
that should be (8,2). Then, left-click MAP001 in the main map screen, to return to the first map. Right-click the Exit
event and then left-click Edit. What you want to do is edit the Transfer Player command so that it points to the dirt
road in our second map. For the sake of this tutorial, let's place the destination at (11,2). Right-click the Transfer Player
command and choose Edit, to make the appropriate changes. What you don't want to do is place it right where you
have the event to transfer to MAP001, as that has the potential to cause issues.
If you have done all of the above, you are now set. Play-test the game and see what happens.
if your character is going through the exit and facing north instead of south, it is because you must manually
change the direction he/she faces after said transition. You can do this by changing the direction setting in the transfer
event dialog screen from retain to down.
Note
Cool! Now, About Those Variables . . .
Okay fine, you're right. Let's apply the usage of variables before we end this chapter and move on to meatier subjects.
Take a look at your second map. Place five trees (wherever you like, so long as you stay within that 23 × 15 area we
populated with grass) around the area. If you managed to copy the map I created earlier, then the five trees you
already have will be perfect.
For larger graphics (such as the trees we've used) that take up more than a single tile of space, you will have to
place each individual tile accordingly. trees have a top tile for foliage and a trunk as the bottom tile.
Note
What we're going to do now is have each tree increase the value of a variable by one when the player interacts
with them. We have to make sure that the player can't just interact with the same tree five times. In other words, each
tree can only be counted once. So, how do we do this? There are several ways, but I'm going to take advantage of the
fact that this is the switches and variables chapter to talk a little about self-switches.
Each event can contain up to four self-switches. While switches and variables have global scope (that is to say, the
value of a switch or variable can be accessed from any other part of RMVXA), self-switches are local in scope. The rest
of your game's events care not if Event #441 on Map #72 has its self-switch B (self-switches go from A to D) set to the
“ON” state. It only holds importance to that one specific event itself.
So, we need an event that does the following:
Displays a text box telling the player a little about the tree.
Increases the value of the Tree variable by 1, if it is the first time the player has interacted with
that tree. Otherwise, do nothing.
With that said, if you like a challenge or have previous coding experience, I invite you to try and figure this one
out by yourself. You'll need to keep in mind the following:
The tree is a solid object, unlike the cave entrance/clearing we have used as our pair of exits so
far during the topic. That means the player will not be able to step on the event square.
It is preferable that the player interact with the tree rather than having to run into it to trigger
the event.
You will need a new Event Command called
Conditional Branch to check for the self-switch.
 
 
Search WWH ::




Custom Search