Hour 22. Using Linear Velocity for Realistic Movement

What You’ll Learn in This Hour

• How to calculate velocity from any direction

• How to move based on rotation angle

• How to calculate the angle to a target

• How to make final changes to the Android game engine

This hour expands on the concepts learned in the last two hours—dealing with transforms and collision detection—to move objects in any direction based on velocity of an angle. We will derive the math calculations needed to move a sprite in any desired direction based on its rotation angle (from a top-down perspective). Moving a sprite at a desired angle is a very important need in most games, so you will no doubt use this technique extensively in your own projects. The next related ...

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

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