Game Development Reference
In-Depth Information
The ModeGame class maintains pointers to the two instances of Flag so that it can be
detected when they have scrolled offscreen and need repositioning, plus we can also
use these pointers to work out when the player has moved between them.
Randomly placed rocks have also been introduced, which must be avoided because
colliding with them ends the game, just like steering into the trees does. These
are represented by another new class called Rock . This class is very similar to the
existing Tree class, the main difference being that when the rock scrolls off the top
of the screen it is replaced at the bottom with a new horizontal position.
Animations added
Given the subject matter of this chapter, it's fairly obvious that adding animations
to the game would be one of the changes made.
Our little skier character has been given a looping animation, so the little chap now
pushes himself along using his skiing poles. If the player collides with a tree or
rock, the poor little fellow will also now take a tumble and end up in a heap on the
ground. Ouch!
The other animation added to the game has been for the flag. It is the same animation
structure demonstrated in this chapter's other example project. A sub-animation
plays to make the flag wave in the wind, while the main animation is of the flagpole
wobbling about.
Rather than wobbling at set time intervals, the animation is instead triggered when
the player skis too close to the flag.
Summary
We've covered the topic of 3D animation quite extensively in this chapter. We can
now move, rotate, and scale our 3D models in the game world, and we can make the
actual shape of the model change using boned animations to make characters walk,
run, jump, dance, or whatever we require them to do.
We've also looked at some more advanced topics, such as blending between
animations, applying sub-animations on top of a main animation, and retrieving
bone position and orientation information from an in-progress animation to allow us
to find the location of a particular part of a model.
In the next chapter we'll return to just two dimensions, as we look at how we can
make the user interface of our games look a little prettier than just using badly laid
out debug fonts.
 
Search WWH ::




Custom Search