Game Development Reference
In-Depth Information
The easiest way to fix this is simply to add 1 to the value of the y2 variable in the
check_standing_on script so that it checks a little bit further down despite any rounding.
However, this also breaks the sliding mechanic of obj_flynn_ice , so you'll need to swap all the
place_meeting functions in the Begin Step event over to use check_standing_on instead. You'll
find we've done both of these things for you in the next version of the game.
Lights, Camera, Action!
It's time to take another jump in the implementation of the game. Open up shadows4.gmk from
the Chapter12/Games directory of the CD and run it. You should find yourself transported to the
beach at the foot of the pirate town: Rogues' Rendezvous (see Figure 12-5). If you explore this
level (or look in the Room Editor), then you'll see this is a very tall, thin room with platforms
winding their way up between the faces of two cliffs. Apart from changing the room, we've not
altered a massive amount since last time, but we've created a host of new resources (which we'll
explain as we go along) and made a few tweaks and additions, listed next.
Additions to shadows4.gmk
1.
Flynn has a couple of new states that we've implemented for you: FSTATE_BARGE and
FSTATE_DEAD . The former will allow Flynn to destroy skeletons by knocking them off
platforms or into hazards. The latter is an alternative dying animation for when Flynn
loses all of his health. Both come with their own animations and behaviors within the
Flynn state objects, but none of it is particularly new or taxing, so you should be able to
take a look at the code and figure out how it works for yourself.
2.
We've made some changes to how the lifts look. No surprise there, but it's worth
peeking at how we've done this. When you place a lift instance in the Room Editor, it
looks pretty much as it always did, complete with direction arrows. However, they look
quite different in the game and have magic chains that appear at either end. You'll find
the interesting code in obj_lift , which is used as a parent by all the other lifts. It uses a
new script called cord_attach_height to calculate the end point of the chain and
another called draw_cord to draw it. The cord_attach_height script can slow down the
game because of the number of collision tests it makes, so it is initially called in the
Room Start event and not called again unless the lift moves horizontally. Drawing all
the chains in the whole level could also slow down the game, so the draw_cord script
only draws the chains that are visible within the current view. Without optimizing the
chains in this way, the game would start to slow down on less powerful machines.
3.
We've also created empty state objects for the skeleton pirates and Archie the parrot.
This includes a set of constants for their different states and Draw events to display the
appropriate sprites in each state. They might look like they're part of the game, but
they are doing nothing more than animating at the moment.
 
Search WWH ::




Custom Search