-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdrop.html
196 lines (172 loc) · 5.83 KB
/
drop.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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
<!DOCTYPE html>
<html>
<head>
<title>Games - Drop</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="content"></div>
<h1>Drop</h1>
<p>Two player game about not getting wett</p>
<script type="application/processing">
//Positions for grass??
var xPositions = [90, 160, 200, 220, 240, 260, 280, 300, 320, 340];
var yPositions = [20, 20, 20, 20, 20, 20, 20, 20, 20, 20];
var BlobbX = 200*2;
var grass = loadImage("GrassBlock.png");
var points = 0;
var ladda = -150;
var laddahastihet = 2;
var increaseCharge = 0;
var skyColor = 0;
var xCloud = 0;
void setup() {
size(800, 800);
}
void keyPressed() {
//styra
if (keyCode === LEFT) {
BlobbX -= 4;
}
if(keyCode === RIGHT){
BlobbX += 4;
}
}
var cloud = function(xCloudx) {
noStroke();
fill(255, 255, 255);
ellipse(xCloudx + 20, 200, 230, 110);
ellipse(xCloudx + 34, 192, 62*2, 27*2);
ellipse(xCloudx + 18, 160, 50*2, 35*2);
ellipse(xCloudx + 600, 160, 43*2, 30*2);
ellipse(xCloudx + 317*2, 67, 70, 50);
ellipse(xCloudx + 347*2, 77*2, 80*2, 30*2);
xCloud++;
if (xCloudx > 1000) {
xCloudx = -800;
}
stroke(0, 0, 0);
};
// Add Dropp
mouseClicked = function() {
if(ladda>=0){
ladda = -150;
xPositions.push(mouseX);
yPositions.push(10);
}
};
draw = function() {
background(0, 162, 255);
//clouds
for (var i = 0; i < laddahastihet; i++) {
cloud(i*428);
}
//laddare
fill(0, 0, 0);
rect(700, 100, 50, 150);
fill(255, 0, 0);
rect(700, 100 - ladda, 50, 150 + ladda);
fill(0, 0, 0);
// Points Text
text(points, 102, 118, 472, 550);
// Blobb
noFill();
rect(BlobbX - 50, 500, 100, 100);
fill(252, 0, 252);
ellipse(BlobbX, 550, 100, 100);
fill(0,0,0);
ellipse(BlobbX + 20, 568, 40, 26);
ellipse(BlobbX - 20, 568, 40, 20);
ellipse(BlobbX + 26, 542, 20, 20);
fill(173, 0, 0);
ellipse(BlobbX - 22, 542, 20, 20);
if (BlobbX < 50) {
//Blobb
noFill();
rect(800 + BlobbX - 50, 500, 100, 100);
fill(252, 0, 252);
ellipse(800 + BlobbX, 550, 100, 100);
fill(0,0,0);
ellipse(800 + BlobbX + 20, 568, 40, 26);
ellipse(800 + BlobbX - 20, 568, 40, 20);
ellipse(800 + BlobbX + 26, 542, 20, 20);
fill(173, 0, 0);
ellipse(800 + BlobbX - 22, 542, 20, 20);
}
if (BlobbX > 750) {
//Blobb
noFill();
rect(-400*2+BlobbX-50, 500, 100, 100);
fill(252, 0, 252);
ellipse(-400*2 + BlobbX, 550, 100, 100);
fill(0,0,0);
ellipse(-800 + BlobbX + 20, 568, 40, 26);
ellipse(-800 + BlobbX - 10, 284, 20, 20);
ellipse(-800 + BlobbX + 26, 542, 20, 20);
fill(173, 0, 0);
ellipse(-800 + BlobbX - 22, 542, 20, 20);
}
if(BlobbX <= -50) {
BlobbX = 750;
}
if(BlobbX > 850){
BlobbX = 50;
}
// Droppar som faller
for (var i = 0; i < xPositions.length; i++) {
fill(0, 79, 163);
ellipse(xPositions[i], yPositions[i], 20, 20);
yPositions[i] += 10;
if(yPositions[i] > 500 && yPositions[i] < 600 && xPositions[i] < BlobbX + 2*25 && xPositions[i] > BlobbX-25){
println("GAME OVER");
textSize(50*2);
text("points" + points, 262, 260, 256, 250);
draw = 1;
}
}
for (var flytta = 0; 40 > flytta; flytta++) {
image(grass, 184*flytta , 456, 186, 488);
}
points++;
increaseCharge++;
if (increaseCharge > 2000) {
increaseCharge = 0;
laddahastihet++;
println("level up");
}
if (ladda<0) {
ladda += laddahastihet;
}
};
</script>
<canvas> </canvas>
</div>
</body>
</html>