Game Object Physics and Animation
All of our game objects will move on a two-dimensional plane. We will
use basic directional movement vectors to calculate the change in the
x and y coordinates for each game object. At its very
basic level, we will be updating the delta x (dx) and delta y
(dy) of each of our game objects on
each frame to simulate movement. These dx and dy
values will be based on the angle and direction in which we want the
object to move. All of our logical display objects will add their
respective dx and dy values to their x and y
values on each frame of animation. The player ship will not use strict
dx and dy because it needs to be able to float and turn
independently. Let’s take a closer look at the player movement now.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access