Game Development Reference
In-Depth Information
Ant Attack
In the original game, the precise mechanics of Zool's attack moves actually varied quite a bit
between different platforms. As usual, we're not trying to be completely faithful to a particular
version, but pick and choose features that work well with the Game Maker platform. There will be
a number of new states to support jumping, kicking, spinning, and shooting attacks, but most of
these will be incorporated into the existing state object structure. In fact, only one new state
object needs to be created, and that's for the dying state.
Adding the New States to the Zool Object
1.
Go to the Resources menu and select Define Constants . Insert three new constants for
the new Zool states: ZSTATE_KICK , ZSTATE_SPIN , and ZSTATE_DEAD and assign them the
values 8 to 10 , consecutively. If you don't have the Pro version of Game Maker, then
you will need to define these as variables in the Create event of obj_zool instead.
Reopen obj_zool and select the Draw Event .
2.
3.
Immediately before the End Block of the block of actions for facing right, include a
Test Variable action ( control tab) that tests if state is equal to ZSTATE_KICK .
Follow this with a Draw Sprite action ( draw tab) that draws spr_zool_kick_right at a
Relative position of X = 0 , Y = 0 .
4.
Repeat steps 3-4 for ZSTATE_SPIN and ZSTATE_DEAD , using the appropriate sprites but
the same other settings.
5.
6.
Repeat steps 3-5 within the block of actions for facing left using the corresponding left-
facing sprites. You now have more actions in the Draw event than anyone cares to
count and you'll be pleased to hear that that's the last of them!
Splitting Headache
Since the early beginnings of platform games, it has become accepted that even the most
terrifying enemies that inhabit them are liable to roll over and die after the gentlest downward
contact between their head and the player's feet. Strange as it is, it's a great game mechanic that
worked for many games, and Zool was no exception. So we'll begin by changing the way we
handle collisions between Zool and the enemies.
Adding Jump Attack Behavior to Zool
1.
Reopen obj_zool and select the Collision event with obj_enemy . This event currently
provides the same “jumping back and losing health” behavior for a collision with
enemies that we already had for hazards. However, we actually only want this behavior
to apply if Zool isn't jumping on the enemy's head.
2.
Include a Test Variable action ( control tab) at the very start of the list of actions that
tests whether vspeed is larger than 0 .
3.
Immediately follow this with a Start Block action.
Follow this with a Speed Vertical action ( move tab) that sets Vert. Speed to -14 .
4.
5.
Follow this with a Destroy Instance action ( main1 tab) with Applies to set to Other
(the enemy instance).
 
Search WWH ::




Custom Search