forked from TheCBKM/Pong_IT
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
70 lines (68 loc) · 1.83 KB
/
index.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
var l1,l2,l3,l4,l5,l6,l7;
function setup(){
startUp();
l1=new Ball(10*w,60*h,40*w/h);
l2=new Ball(50*w,60*h,40*w/h);
l3=new Ball(90*w,60*h,40*w/h);
l4=new Ball(10*w,75*h,40*w/h);
l5=new Ball(50*w,75*h,40*w/h);
l6=new Ball(90*w,75*h,40*w/h);
l7=new Ball(50*w,90*h,40*w/h);
createCanvas(100*w,100*h);
background(0);
checkCookie('highScore');
checkCookie('recentTime');
checkCookie('level');
}
function draw(){
noStroke();
//background(0);
l1.create();l2.create();l3.create();l4.create();l5.create();l6.create();l7.create();
textSize(l1.r/1.5);
fill(255,255,0);
textSize(50*w/h);
text('PonG-PinG',20*w,17*h);
textSize(20*w/h);
fill(225);
text('A Mature Game',50*w,20*h);
text('We present',17*w,10*h);
text('CBKM & PM',70*w,95*h);
textSize(40*w/h);
fill(225,125,202);
text('High-Score: '+getCookie('highScore'),20*w,30*h);
text('Latest-Score: '+getCookie('recentTime'),20*w,40*h);
text('Level: '+getCookie('level'),20*w,50*h);
fill(255,255,0);
textAlign(CENTER);
text('L1',l1.x,l1.y+2*h);
text('L2',l2.x,l2.y+2*h);
text('L3',l3.x,l3.y+2*h);
text('L4',l4.x,l4.y+2*h);
text('L5',l5.x,l5.y+2*h);
text('L6',l6.x,l6.y+2*h);
text('L7',l7.x,l7.y+2*h);
noLoop();
}
function mousePressed(){
var d=dist(l1.x,l1.y,mouseX,mouseY);
if(d<l1.r)
window.location.href='L1.html';
var d=dist(l2.x,l2.y,mouseX,mouseY);
if(d<l2.r)
window.location.href='L2.html';
var d=dist(l3.x,l3.y,mouseX,mouseY);
if(d<l3.r)
window.location.href='L3.html';
var d=dist(l4.x,l4.y,mouseX,mouseY);
if(d<l4.r)
window.location.href='L4.html';
var d=dist(l5.x,l5.y,mouseX,mouseY);
if(d<l5.r)
window.location.href='L5.html';
var d=dist(l6.x,l6.y,mouseX,mouseY);
if(d<l6.r)
window.location.href='L6.html';
var d=dist(l7.x,l7.y,mouseX,mouseY);
if(d<l7.r)
window.location.href='L7.html';
}