Home > Articles

  • Print
  • + Share This
This chapter is from the book

Q&A

  1. 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?

  2. 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.

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

  4. 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.

  • + Share This
  • 🔖 Save To Your Account