-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
159 lines (143 loc) · 5.4 KB
/
index.html
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
<!DOCTYPE html>
<html>
<head>
<title>Games - Mustachio</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/processing.js/1.6.0/processing.min.js"></script>
<link href="style.css" rel="stylesheet">
</head>
<body>
<!-- ================================
Start Navigation Bar
================================= -->
<header>
<div class="headerCol">
<div class="container-fluid">
<div class="row align-items-center">
<div class="col">
<div class="navCollapseCol">
<div class="navCol">
<ul>
<li><a href="index.html">Mustachio</a></li>
<li><a href="drop.html">Drop</a></li>
<li><a href="BallUppAndDown.html">Ball Upp and Down</a></li>
<li><a href="aquarium.html">Aquarium</a></li>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
</header>
<!-- ================================
End Navigation Bar
================================= -->
<div class="row align-items-center"></div>
<h1>Mustachio</h1>
<p>A fun Game about a fun dude jumping</p>
<script type="application/processing">
var h = 0;
var k = 0;
var x = 0;
var Level = 1;
var bredd = 0;
var move = 0;
var hastighet = 2;
var stageLength = 6800;
var points = (move + stageLength * (Level-2));
void setup() {
size(900, 800);
}
var GameOver = function(recX,recY,recBredd,recLangd){
rect(recX-move,recY,recBredd,recLangd);
if(recX-move<mouseX+25*2-bredd/2+bredd && mouseX-25*2-bredd/2<recX-move+recBredd && recY < 275*2-25*2-h-bredd/2 + 50*2+bredd && 275*2-25*2-h-bredd/2<recY+recLangd){
println("GAME OVER");
fill(0,0,0);
textSize(50*2);
text("GAME OVER",100,100);
text("Points "+(move+stageLength * (Level-1)),100, 200);
fill(255,0,0);
GameOver = 1;
}
};
draw = function() {
background(14, 116, 204);
//clouds
noStroke();
fill(255, 255, 255);
ellipse(x + 20, 200,115*2,55*2);
ellipse(x + 34, 96*2,62*2,27*2);
ellipse(x + 18,160,50*2,35*2);
ellipse(x + 300*2,80*2,43*2,30*2);
ellipse(x + 317*2,67*2,70*2,50*2);
ellipse(x + 347*2,77*2,80*2,30*2);
x++;
if (x > 500*2){x = -400*2; }
stroke(0, 0, 0);
fill(37*2, 224*2, 0);
rect(-15*2,600,1010,445*2);
//Jump
if(keyPressed){
h = h+40;
bredd += 4;
k++;
}
if (h<0){
h = 0;
}
if(275*2-bredd/4-h<0){
h = 275*2-bredd/4;
}
//Gravety
h = h - 2;
bredd -= 0.6;
if (bredd<0){
bredd = 0;
}
//Blobb
noFill();
rect(mouseX-50-bredd/2,275*2-25*2-h-bredd/2,100+bredd,100+bredd);
fill(252, 0, 252);
ellipse(mouseX, 550-h,100+bredd,100+bredd);
fill(0,0,0);
ellipse(mouseX+10*2,284*2-h,20*2,26);
ellipse(mouseX-10*2,284*2-h,20*2,20);
ellipse(mouseX+13*2,271*2-h,10*2,20);
fill(173, 0, 0);
ellipse(mouseX+-11*2,271*2-h,20,20);
noStroke();
//stage
stroke(0, 0, 0);
fill(255, 0, 0);
GameOver(434*2,492,80,106);
GameOver(599*2,282,80,106);
GameOver(770*2,420,80,108);
GameOver(890*2,202,80,106);
GameOver(1074*2,178*2,75*2,124*2);
GameOver(1296,108,61,92*2);
GameOver(1413*2,146*2,61*2,92*2);
GameOver(1691*2,100*2,49*2,118*2);
GameOver(1891*2,146*2,49*2,118*2);
GameOver(2091*2,186*2,49*2,118*2);
GameOver(2291*2,146*2,49*2,118*2);
GameOver(2491*2,46*2,49*2,118*2);
GameOver(2691*2,146*2,100*2,118*2);
GameOver(2890*2,26*2,49*2,70*2);
GameOver(3050*2,116*2,49*2,118*2);
GameOver(3250*2,146*2,49*2,118*2);
move = move + hastighet;
if(move > stageLength){
hastighet++;
Level++;
move = 0;
println("Level " + Level);
}
fill(0,0,0);
textSize(24);
text("Points "+ (move+stageLength * (Level-1)),20,20);
};
</script>
<canvas> </canvas>
</div>
</body>
</html>