HTML and CSS Reference
In-Depth Information
animation phase of the game, this value determines when the player has arrived at its new
y-axis location.
player.x
The current
x
location of the top-left corner of the 32×32 player object.
player.y
The current
y
location of the top-left corner of the 32×32 player object.
player.dx
The player's change in
x
direction on each frame tick while it is animating. This will be
−1
,
0
, or
1
, depending on the direction in which the player is moving.
player.dy
The player's change in
y
direction on each frame tick while it is animating. This will be
−1
,
0
, or
1
, depending on the direction in which the player is moving.
player.hit
Set to
true
when the player moves to a new square that is occupied by an enemy tank or
a wall.
player.dead
When
player.hit
is
true
, it is replaced on the
playField
by an explosion sprite. With
dead
set to
true
, it is not rendered to the game screen.
player.win
Set to
true
if the player collects the goal object.
The enemy and the player share many of the same attributes because they both use the same
type of calculations to move about the grid. Now let's examine how the enemy object is con-
structed.