We have already mentioned the concept of a sprite being an entity that is drawn and handled at a specific position on a screen. Essentially, everything we see in a game are sprites. There are exceptions, such as game controllers (which do not draw anything) and backgrounds (which are drawn in a different way), but we will talk about them later in the chapter.

So, this is the code for the Sprite class that extends GameObject:

public abstract class Sprite extends GameObject { protected double mPositionX; protected double mPositionY; protected final double mPixelFactor; private final Bitmap mBitmap; protected final int mImageHeight; protected final int mImageWidth; private final Matrix mMatrix = new Matrix(); protected Sprite (GameEngine gameEngine, ...

Get Android: Programming for Developers now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.