Game Development Reference
In-Depth Information
I included this bit of fine-tuning in the class because if no friction is being applied while the charac-
ter is moving, its movement is a little more fluid and a little more responsive. It's entirely up to you
whether you'll feel the same way about the characters in the games you'll be designing.
Bounce variables
There are two new variables in this class that you haven't used before: [^kqj_aT and [^kqj_aU. These
variables are used to accept bounce values that will be sent to the class by the platforms that the
lh]uan object will be jumping on. Without these values available, the lh]uan object can't bounce on
platforms. You'll use a special collision utility to control how the player interacts with platforms (dis-
cussed later).
The variables [^kqj_aT and [^kqj_aU are unrelated to the >KQJ?A constant. The >KQJ?A constant is
used to define the “bounciness” of the lh]uan object. In the game that you'll be designing, the >KQJ?A
constant is used only to define by how much the lh]uan object will bounce when it hits the bottom
of the stage.
Notice that the bottom of the stage is offset by 10 pixels, which gives you some space to add the
10-pixel-high ground graphic. This offset is defined by the >KPPKI[KB[OP=CA constant, which is defined
at the beginning of the class definition.
Player collision area
Another small but important change is that the cat's ^k`u subobject, which will be used as the colli-
sion area, is now assigned to a [_khheoekj=na] variable.
This is important because the code will access this property to check which part of the lh]uan object
should be checked for collisions with platforms.
Search Nedrilad ::

Custom Search