QA


Q&A

Q1:

Why doesn't the Henway game take advantage of the SA_KILL sprite action to kill the chicken sprite when the chicken gets run over?

A1:

It's logical that because the chicken is getting run over, you might think that the chicken sprite should go away. However, you have to consider that the chicken sprite immediately gets used again if the player has more lives left. And even if the game is over, it doesn't hurt to keep the chicken sprite around because it will undoubtedly be used again if a new game is started. For these reasons, it makes sense to keep the chicken sprite around throughout the entire game, and simply move it back to the Start Area whenever a chicken is run over in the game. Don't worry: You'll still get around to using the SA_KILL sprite action to kill off some sprites a little later in the book.

Q2:

Why is the input delay variable necessary in the Henway game?

A2:

The best way to answer this question is to just have you change the line of code that checks the input delay variable in the HandleKeys() and HandleJoystick() functions. Where the code says ++_iInputDelay > 2 , just change the code to be ++_iInputDelay > 0 . This will remove the effect of the _iInputDelay variable and will cause the keyboard and joystick to be checked in every game cycle, as opposed to every third cycle. You'll find out that the keyboard and joystick are way too responsive and end up making the chicken move around too fast. This is one of those rare instances in which you actually want to slow down an aspect of a game to improve its playability.



Sams Teach Yourself Game Programming in 24 Hours
Sams Teach Yourself Game Programming in 24 Hours
ISBN: 067232461X
EAN: 2147483647
Year: 2002
Pages: 271

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net