Game Development Reference
In-Depth Information
@>Control Variables: [0002:X] = Player's Map X
@>Control Variables: [0003:Y] = Player's Map Y
@>Get Location Info: [0017], Terrain Tag, Variable [0002][0003]
@>Conditional Branch: Variable [0017:TerrainTag] == 1
@>Loop
@>Set Move Route: Player (Skip, Wait)
: : $>Walking Animation OFF
: : $>Change Speed: 5
: : $>Change Freq: 5
@>Label: Repeat
As is standard with most of our Parallel Process events, we have it write the player's current location to a pair of
variables and then fetch the location info for the tile that the player character is standing on at that precise moment.
Next, we have a conditional branch that only triggers if the Terrain Tag is equal to 1. If it is, we use the Loop event
command. As per its name, event commands within a Loop will repeat endlessly until you use a Jump To Label to
escape the loop. In essence, an Autorun event is a loop (which is the reason why it is so easy to accidentally hang your
game using one, if you forget to use a self-switch or some other method to break out of the event page).
The first order of action when the event enters its loop is to make it so that the player appears as if he/she is
sliding on air. As mentioned near the start of the topic, turning off a character's walking animation will accomplish
precisely that. We can increase the speed at which the player slips on ice by using Change Speed and increasing its
value. I set it to 5. Change Frequency does nothing in this particular exercise, but I kept it there for testing purposes.
You'll see why it does nothing, as I reveal more of the event. The last thing I placed in that sample code was Label:
Repeat . That was not a coincidence. Everything after that label will be repeated until a certain condition is met (more
on that later). Here's the second part of the event:
@>Control Switches: [0026:WalkMovement] = OFF
@>Set Move Route: Player (Skip, Wait)
: : $>1 Step Forward
@>Control Variables: [0019:X'] = Player's Map X
@>Control Variables: [0020:Y'] = Player's Map Y
@>Conditional Branch: Variable [0019:X'] == Variable [0002:X]
@>Conditional Branch: Variable [0020:Y'] == Variable [0003:Y]
@>Jump to Label: GoToNext
@>
: Else
@>Control Variables: [0002:X] = Player's Map X
@>Control Variables: [0003:Y] = Player's Map Y
@>Jump to Label: Repeat
@>
: Branch End
@>
: Else
@>Control Variables: [0002:X] = Player's Map X
@>Control Variables: [0003:Y] = Player's Map Y
@>Jump to Label: Repeat
@>
: Branch End
As of this time, the player character has no walking animation. We want to have a dedicated switch that is off
when the player cannot move and is flipped on when he/she can. (You could invert the states so that the switch is on
when the player cannot move. Just make sure you keep track of the fact.) WalkMovement will be that switch. We'll have
a conditional branch after this loop that checks to see if WalkMovement is off. If it is, we restore the player's walking
animation and normalize his/her speed. But, I'm getting ahead of myself.
Search WWH ::




Custom Search