HTML and CSS Reference
In-Depth Information
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 inde-
pendently. Let's take a closer look at the player movement now.