Game Development Reference
In-Depth Information
Not So Solid Ground
Falling platforms are another common feature in platform games. In Zool, these resemble static
lifts, but fall away beneath the player's feet a moment or two after the player stands on them. This
keeps the player on their toes and makes sure they keep moving. We'll also make them respawn
after a certain amount of time to give the player another chance at getting through a tricky set of
falling platforms.
Creating Falling Platforms
1.
Create a new object (
Platforms
,
Lifts
group) called
obj_ledge_fall
, give it the
spr_ledge_fall
sprite, the
obj_ledge
Parent
, and set
Depth
to
-1001
.
2.
Add a
Create
event and include a
Set Variable
action (
control
tab) that sets
falling
to
false
.
3.
Add a
Step, Step
event and include a
Check Object
action to check if there would be a
collision with an instance of
obj_zool
at a
Relative
position of
X
=
0
,
Y
=
-16
.
4.
Follow this with a
Test Variable
action that tests if
falling
is
equal to
false
.
5.
Follow this with a
Start Block
action.
6.
Include a
Set Variable
action that sets
falling
to
true
.
7.
Include a
Set Alarm
action (
main2
tab) that sets
Alarm 0
to
30
Steps
.
8.
Include an
End Block
action (
control
tab).
9.
Add an
Alarm, Alarm 0
event and include a
Set Gravity
action (
move
tab) that sets
Gravity
to
3
in
Direction
270
.
10.
Add an
Other, Outside Room
event and include a
Test Variable
action (
control
tab)
that tests if
falling
is
equal to
true
.
11.
Include a
Start Block
action.
12.
Include a
Set Variable
action that sets
falling
to
false
.
13.
Include a
Set Gravity
action (
move
tab) that sets
Gravity
to
0
in
Direction
270
.
14.
Include a
Set Variable
action (
control
tab) that sets
speed
to
0
. This is another way of
stopping an instance dead.
15.
Include a
Set
Alarm
event (
main2
tab) that sets
Alarm 1
to
300
Steps
.
16.
Include an
End Block
action (
control
tab).
17.
Add an
Alarm, Alarm 1
event and include a
Jump to Start
action (
move
tab).
At this point, you should now be in a position to create the final layout of your test level
including all of the enemies, platforms, and collectibles. You can either take some time to do this
for yourself or load the file
zool13.gmk
from the
Chapter06/Games
directory on the CD.
Search WWH ::
Custom Search