Finishing Things Up and Making It Fast

Now you have just about everything you need for the game. Of course, some of the basics, such as keyboard input, sound, and music, are in the game, too, but these functions exist in classes not listed in this chapter. Besides the classes already listed in this chapter, there are three other classes:

  • GameManager Handles keyboard input, updates sprites, provides collision detection, and plays sound and music.
  • TileMapRenderer Draws the tile map, parallax background, and sprites.
  • ResourceManager Loads images, creates animations and sprites, and loads levels.

Don't worry; the source code for these classes is on the website, and the code relevant to this chapter was listed here and there. To make the game run at a higher frame rate, a couple of changes were made to the GameCore class:

  • A 16-bit color mode is the first choice to provide faster frame rates.
  • The code to sleep for 20 milliseconds in the game loop was removed so that the game uses all the processor power possible.