HTML and CSS Reference
In-Depth Information
The Player
The player and all its current attributes are contained in the
player
object. Even a game as
simple as
Micro Tank Maze
requires quite a few attributes. Here is a list and description of
each:
player.row
The current row on the 15×15
playField
grid where the player resides.
player.col
The current column on the 15×15
playField
grid where the player resides.
player.nextRow
player.nextRow
The row the player moves to next, after a successful key press in that direction.
player.nextCol
The column the player moves to next, after a successful key press in that direction.
player.currentTile
The id of the current tile that displays the player from the
playerTiles
array.
player.rotation
The player starts pointed up, so this is the 0 rotation. When the player moves in one of
the four basic directions, this rotation changes and moves the player in the direction it is
facing.
player.speed
The number of pixels the
player
object moves on each frame tick.
player.destinationX
Thefinal
x
locationforthe32×32
player
objectwhileitismovingtoanewtile.Itrepres-
ents the top-left corner
x
location for this new location. During the player movement and
animation phase of the game, this value determines when the player has arrived at its new
x-axis location.
player.destinationY
Thefinal
y
locationforthe32×32
player
objectwhileitismovingtoanewtile.Itrepres-
ents the top-left corner
y
location for this new location. During the player movement and