O'Reilly logo

Sams Teach Yourself Android Game Programming in 24 Hours by Jonathan S. Harbour

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required