-
Notifications
You must be signed in to change notification settings - Fork 0
/
Stage.js
60 lines (57 loc) · 1.63 KB
/
Stage.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
function Stage(id, backgroundImage, money, lives) {
this.id = id;
this.backgroundImage = backgroundImage;
this.paths = new Array();
if (typeof money == "undefined") {
money = -1;
}
if (typeof lives == "undefined") {
lives = -1;
}
this.money = money;
this.lives = lives;
}
/*Adds a path to the stage
* @param {Point[]} points An array of points for the path
* @param {double} width Half the path's width (path will extend width from center line)
* @param {String} color The color to draw the path
* @param {String} highlightColor The color to draw the gradient highlights
* @param {String} shadowColor The color to draw the dropShadow of the path.
* @param {String} startColor The color to draw the start of a path
* @param {String} startHighlightColor The color of the start for gradient
* @param {String} endColor The color to draw the end of a path
* @param {String} endHighlightColor The color to draw the end for gradient
* @param {Boolean} hide If false, the path is not drawn. If true it is drawn
*/
Stage.prototype.addPath = function (
points,
width,
color,
highlightColor,
shadowColor,
startColor,
startHighlightColor,
endColor,
endHighlightColor,
hide
) {
var path = new Path(
points,
width,
color,
highlightColor,
shadowColor,
startColor,
startHighlightColor,
endColor,
endHighlightColor,
hide
);
this.paths.push(path);
};
Stage.prototype.draw = function (ctx) {
//Draw a rectangle over the entire area
for (var i = 0; i < this.paths.length; i++) {
this.paths[i].draw(ctx);
}
};