Game Objects and 2D Graphics
Most games have many different characters and other objects, and an important decision is how to represent these objects. This chapter first covers different methods of object representation. Next, it continues the discussion of 2D graphics techniques by introducing sprites, sprite animations, and scrolling backgrounds. This chapter culminates with a side-scrolling demo that applies the covered techniques.
The Pong game created in Chapter 1 does not use separate classes to represent the wall, paddles, and ball. Instead, the
Game class uses member variables to track the position and velocity of the different elements of the game. While this can work for a very simple game, it’s not a scalable ...