-
Notifications
You must be signed in to change notification settings - Fork 2
/
lvl2.js
81 lines (57 loc) · 2.29 KB
/
lvl2.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
(function(){
function lvl2(io){
//CANVAS VARS
this.io = io;
this.cHeight = io.canvas.height;
this.cWidth = io.canvas.width;
//GAME VARS
this.goal =
this.goalTouch =
this.goalEffect = undefined;
this.goalTime = 150;
this.goalTouchTime = 0;
this.gameWin =
this.gameWinAnim =
this.gameEnd = false;
}; iio.lvl2 = lvl2;
lvl2.prototype.setup = function(){
levelBuilder.setup(this,'lvl2');
//SHAPES!
bodyDef = new b2BodyDef;
fixDef = new b2FixtureDef;
fixDef.friction = 0.5;
fixDef.restitution = 0.3;
fixDef.density = 5;
bodyDef.type = b2Body.b2_dynamicBody;
fixDef.shape = new b2PolygonShape;
fixDef.shape.SetAsBox(pxConv(1),pxConv(1));
bodyDef.position.Set(pxConv(this.cWidth/2 ,true),pxConv(this.cHeight/2 ,true));
prepShape(bodyDef, fixDef).setFillStyle(colors['navy'][0]).setStrokeStyle(colors['navy'][1],pxConv(2));
/*lol*/
fixDef.shape.SetAsBox(pxConv(0.8),pxConv(0.8));
bodyDef.position.Set(pxConv(this.cWidth/2 + (2 * PTM),true),pxConv(this.cHeight - (45),true));
prepShape(bodyDef, fixDef).setFillStyle(colors['red'][0]).setStrokeStyle(colors['red'][1],pxConv(2));
/*lol*/
fixDef.shape.SetAsBox(pxConv(0.8),pxConv(0.8));
bodyDef.position.Set(pxConv(0.8,true),pxConv(this.cHeight - (45),true));
prepShape(bodyDef, fixDef).setFillStyle(colors['green'][0]).setStrokeStyle(colors['green'][1],pxConv(2));
fixDef.shape.SetAsBox(pxConv(0.8),pxConv(1.5));
bodyDef.position.Set(pxConv(this.cWidth/2 + (4 * PTM),true),pxConv(this.cHeight - (45),true));
prepShape(bodyDef, fixDef).setFillStyle(colors['blue'][0]).setStrokeStyle(colors['blue'][1],pxConv(2));
fixDef.shape.SetAsBox(pxConv(0.8),pxConv(1.2));
bodyDef.angle = -0.5;
bodyDef.position.Set(pxConv(this.cWidth/2 - (80),true),pxConv(this.cHeight - (45),true));
prepShape(bodyDef, fixDef).setFillStyle(colors['turquoise'][0]).setStrokeStyle(colors['turquoise'][1],pxConv(2));
fixDef.shape.SetAsBox(pxConv(0.8),pxConv(1));
bodyDef.angle = 0;
bodyDef.position.Set(pxConv(this.cWidth/2 + (45),true),pxConv(this.cHeight - (25),true));
prepShape(bodyDef, fixDef).setFillStyle(colors['purple'][0]).setStrokeStyle(colors['purple'][1],pxConv(2));
}//SETUP
lvl2.prototype.step = function(){
levelBuilder.step(this);
}//STEP
iio.AppManager.prototype.activatelvl2 = function(io){
this.level = new iio.lvl2(io);
return this.level;
}
})();