-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathlvl3.js
More file actions
68 lines (49 loc) · 1.83 KB
/
Copy pathlvl3.js
File metadata and controls
68 lines (49 loc) · 1.83 KB
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
(function(){
function lvl3(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.lvl3 = lvl3;
lvl3.prototype.setup = function(){
levelBuilder.setup(this,'lvl3');
//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['orange'][0]).setStrokeStyle(colors['orange'][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
lvl3.prototype.step = function(){
levelBuilder.step(this);
}//STEP
iio.AppManager.prototype.activatelvl3 = function(io){
this.level = new iio.lvl3(io);
return this.level;
}
})();