Hour 19. Manipulating Sprites with Matrix Transforms

What You’ll Learn in This Hour

• Using matrix translation

• Using matrix rotation

• Using matrix scaling

• Combining all three transforms into one matrix

• Drawing animation frames with matrix transforms

This hour delves into the awesome subject of matrix transforms, giving us the capability to rotate, scale, and translate a sprite. Although we can already translate (move) and scale a sprite using the known drawBitmap() methods, an additional overload of the method takes a Matrix parameter instead. Because matrix math is much faster than trigonometry (that is, using sine and cosine), and because a matrix can handle all three transforms at once, this is clearly where we want to go with our ...

Get Sams Teach Yourself Android Game Programming in 24 Hours now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.