HTML and CSS Reference
In-Depth Information
Our game code stores the tile IDs needed for each of these game objects in application scope
variables:
var
var
playerTiles
=
[
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
];
var
var
enemyTiles
=
[
9
,
10
,
11
,
12
,
13
,
14
,
15
,
16
];
var
var
roadTile
=
0
;
var
var
wallTile
=
30
;
var
var
goalTile
=
23
;
var
var
explodeTiles
=
[
17
,
18
,
19
,
18
,
17
];
The tile sheet is loaded into an application scope
Image
instance and given the name
tileSheet
:
var
var
tileSheet
;
In the application's initialization state, we load and assign the
Image
instance:
tileSheet
=
new
new
Image
();
tileSheet
.
src
=
"tanks_sheet.png"
;
Next, we examine the setup of the game playfield.