-
Notifications
You must be signed in to change notification settings - Fork 1
/
ImageLoad.js
89 lines (78 loc) · 3.16 KB
/
ImageLoad.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
/******************************
Image variables
******************************/
var imgBlueList; //stores the images related to blue units
var imgRedList; //stores the images related to red units
var imgBlank; //stores the image related to an empty spot
var imgForbidden; //stores the image for a forbidden spot
var imgGreen;
var imgBlueListS; //stores the images for a blue unit when it is selected
var imgRedListS; //stores the images for a red unit when it is selected
var imgSinglePlay;
var imgMultiPlay;
var imgMain;
var imgMainSmall;
/***************************************************************************
Image loading functions
************************************************************************/
/*
Loads all the necessary images
*/
function loadImages(){
imgBlueList = new Array(12); //get ready to set the unit images
imgRedList = new Array(13);
var blueHeader = "board_images/B_";
var redHeader = "board_images/R_";
//load spy images
imgBlueList[0] = graphics.loadImage(blueHeader+"S.gif");
imgRedList[0] = graphics.loadImage(redHeader+"S.gif");
//numerical images
for (var i = 1; i < 10; i++){
imgBlueList[i] = graphics.loadImage(blueHeader+i+".gif");
imgRedList[i] = graphics.loadImage(redHeader+i+".gif");
}
//Mines
imgBlueList[10] = graphics.loadImage(blueHeader+"M.gif");
imgRedList[10] = graphics.loadImage(redHeader+"M.gif");
//Flags
imgBlueList[11] = graphics.loadImage(blueHeader+"F.gif");
imgRedList[11] = graphics.loadImage(redHeader+"F.gif");
//"?" symbols
imgBlueList[12] = graphics.loadImage(blueHeader+"Q.gif");
imgRedList[12] = graphics.loadImage(redHeader+"Q.gif");
//Other images
imgBlank = graphics.loadImage("board_images/Blank.gif");
imgForbidden = graphics.loadImage("board_images/No.gif");
imgGreen = graphics.loadImage("board_images/Green.gif");
imgSinglePlay = graphics.loadImage("board_images/SinglePlay.gif");
imgMultiPlay = graphics.loadImage("board_images/MultiPlay.gif");
imgMain = graphics.loadImage("board_images/StrategyChess.gif");
imgMainSmall = graphics.loadImage("board_images/StrategyChessSmall.gif");
loadImagesSelected();
};
/*
Loads images for the board units when they are selected
*/
function loadImagesSelected(){
imgBlueListS = new Array(12); //everything except for the "?", as this is never seen for own units
imgRedListS = new Array(13); //all opponents units, including the "?". This is usually just used when the game is over
var blueHeader = "board_images/B_";
var redHeader = "board_images/R_";
//load spy images
imgBlueListS[0] = graphics.loadImage(blueHeader+"Sc.gif");
imgRedListS[0] = graphics.loadImage(redHeader+"Sc.gif");
//numerical images
for (var i = 1; i < 10; i++){
imgBlueListS[i] = graphics.loadImage(blueHeader+i+"c.gif");
imgRedListS[i] = graphics.loadImage(redHeader+i+"c.gif");
}
//Mines
imgBlueListS[10] = graphics.loadImage(blueHeader+"Mc.gif");
imgRedListS[10] = graphics.loadImage(redHeader+"Mc.gif");
//Flags
imgBlueListS[11] = graphics.loadImage(blueHeader+"Fc.gif");
imgRedListS[11] = graphics.loadImage(redHeader+"Fc.gif");
//"?" symbols
//imgBlueListS[12] = graphics.loadImage(blueHeader+"Qc.gif");
imgRedListS[12] = graphics.loadImage(redHeader+"Qc.gif");
}