-
Notifications
You must be signed in to change notification settings - Fork 0
/
game1.js
70 lines (61 loc) · 1013 Bytes
/
game1.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
var canvas;
var bEnemies = [];
var enemyWidth = 60;
var enemyHeight = 20;
var bullets = [];
var fires= [];
var heroX;
var heroWidth=30;
var heroHeight=20;
var hurdles=[];
var hurdleWidth=20;
var hurdleHeight=10;
var hurdleHit=0;
var heroHit=0;
var i;
var k=0;
var c=0;
var end;
var level=1;
function setup()
{
canvas = createCanvas(600,600);
background(0);
loadLevel_1();0
/*
for(i=1;i<=3;i++)
{
if(i==1)
hurdles[i]= new Hurdle(70);
else if(i==2)
hurdles[i]= new Hurdle(270);
else if(i==3)
hurdles[i]= new Hurdle(470);
}
*/
}
function mousePressed()
{
//createP(hurdles.length);
//createP(bullets.length);
createP(level);
var b= new Bullet();
if(bullets.length==0)
bullets.push(b);
//botX=mouseX;
//fill(255,0,0);
//ellipse(mouseX,mouseY,8,8);
}
function draw()
{
switch(level)
{
case 1: level_1();
break;
case 2: level_2();
break;
case 3: level_3();
break;
}
//level_3();
}