-
Notifications
You must be signed in to change notification settings - Fork 2
/
bugs.js
439 lines (346 loc) · 24.5 KB
/
bugs.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
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
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
function Bug (){
var img = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAAAsSAAALEgHS3X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5YsaKFXV0eDzeqzWDwCAwAAwDxdkD60xZBPQAr32YK/3H3tSLWdhOoBvolJI56aTs9kLZaUk5U5jS2hhjJo1RI1pTBKaBSWAcGAMKsyus/qWeGjiz11DNs60RyADurJ29H8v4s7NYOqPVzxbn/Eu8lbCBxKztJGcB5Bk3neHsbY8/+zv+dRX/537sIWYVF78yhj4j5/4nkf8L1NoXDysv18sAAAAASUVORK5CYII=';
var img_sec = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAIGNIUk0AAHolAACAgwAA+f8AAIDpAAB1MAAA6mAAADqYAAAXb5JfxUYAABM1SURBVHja1Jp5sB/Vdec/93b3b3/7rqcnCfEkWYuRxGKQQWMpCCEEYyxkUiL22GMJE+JxTJw45RSmghhiEpJM4poZewoH49jYMRCBMMsggwEJLUZICCEJIaT3np7evv72pdd754/+AXKCHMFkJpVbdau7f7/u2+d7z/mec+49LbTW/Htukn/nTfx/GF8ANDc3RwzDiACuVlpKQ6K1FlppVxrSU0rhui7ZbPZfB8DNN99sRKPRpVLKNgCt9YmHH3749G8aq6ut60I/FlkllHpTCCNlmsRNKWcV84VXDQNd31zf1tTekJ7R1T71q5cPDXbN6lANjfVyeHjYGBue8u1SRUWiESKRCOvWrcNxHAHISCSiH3zwQfVBLzXPZVpCiN2zZ89e0dTUhNaa/v5+dcstt+zQWt/+yCOPDJ4t+O23377wqaefuVMma083JFMPJWtT2YVz516ViJqTcy+8oO6Z53++qbWzTXquE3NsW9kVZ6ixqf6wZUV23/39P3Hq4rWB1JJf/PyXPPJ3T8aOHzu+5OjRo29s2LAhIoS4vL+/P+jq6pocHBw8cb4amAmcuemmm+TExARCCFavXk13dzfbt28/Ztv2pc8995wDWPfee+9X4/H4H9bW1Ny6c8++UwNj019asXyJcJ1yzZsnj/1Oa0dLwopZhgoCpGWYcTNGV0dnkM3nyUxM7p3ZOeu22q7k6WtuuDp46aldRmGyd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K5YNjf5pSsNtWJzVkfbUk3Eogl832HZdAE/CLNWpWFzjc/vIZl0CrwYkRzSyjlS0UdOpIPnleIU0Af0V7fxbaAGeADYBBSAVdV0+rwA1AAXAwPAuWrDZrX4Nz9qsWTejNi6rpi+qMMQ7bVg/Wg4jikFEk2gNU3RgJVR2zvtM37G1Sf70v6rSjEEDAGDwAiQrQass1s3MAt47YNc6f9tpV5UwXYAXUCHlLQnY7Kr7MoOQ0orXMcrrbWe0joYVYoskAGmgAlgHEhXNRz8W31qYFXLUI3VXgckgUiVZ+/mMnZ1FnNn9fK58px/i28lTCBa5U6sCkCeVel0q9Ueu3ruf1TB/19/7CGqgot/8g511pr7X6X9nwEAeWN4m9aIH+AAAAAASUVORK5CYII=';
//var img = "#";
this.id = 0;
this._posy = (-50);
this._rotation = 0;
this._turningWhile = 0;
this._isSpawning = true;
this._hp = 100;
this._amIDead = false;
this._opacity = 1;
this._turningChance = 30;
this._fowardChance = 100 - this._turningChance;
this._rotateThreshold = 2;
this._movePxThreshold = 1;
this._outOfScreenThreshold = 20;//usado para saber se o bug esta fora da tela
this._posx = this.getRandomInt(this._outOfScreenThreshold, window.innerWidth - this._outOfScreenThreshold);
this.setID = function(i){
this.id = i;
}
this.getID = function(){
return this.id;
}
this.getImg = function(c){
if (c){
return img_sec;
}
else {
return img;
}
}
}
Bug.prototype.amINearWhichBounds = function(){
var left = false, right = false, top = false, bottom = false;
var w = window.innerWidth, h = window.innerHeight;
if (this._posx > (w - (this._outOfScreenThreshold)))
right = true;
if (this._posy > (h - (this._outOfScreenThreshold)))
top = true;
if (this._posx < (this._outOfScreenThreshold))
left = true;
if (this._posy < (this._outOfScreenThreshold))
bottom = true;
return {top: top, bottom: bottom, left: left, right: right};
};
Bug.prototype.AmIOffScreen = function(){
if (
(!this._isSpawning) &&
(
!this.isBetween(this._posy,(-this._outOfScreenThreshold), window.innerHeight + this._outOfScreenThreshold) ||
!this.isBetween(this._posx,(-this._outOfScreenThreshold), window.innerWidth + this._outOfScreenThreshold)
)
){
return true;
}
return false;
};
Bug.prototype.move = function(){
if (this._amIDead)return;
if (this.AmIOffScreen()){this.resetMe();}
var moveFw, turnL, turnR;
moveFw = this.shouldIMoveFoward();
turnL = this.shouldITurnLeft();
turnR = this.shouldITurnRight();
if (this.spawnControl()){
this.moveFoward();
this.drawMe(this.id);
return;
}
var mustGoTo = this.forceMeTurnThatWay();
if (mustGoTo == "left"){
this.turnLeft();
this.drawMe(this.id);return;
} else if (mustGoTo == "right"){
this.turnRight();
this.drawMe(this.id);return;
}
if (moveFw){this.moveFoward(); this.drawMe(this.id); return;};
if (turnR && turnL){
var unTie = Math.random() * 100;
turnL = (unTie > 50);
turnR = !turnL;
}
if (turnR){this.turnRight(); this.drawMe(this.id); return;};
if(turnL){this.turnLeft(); this.drawMe(this.id); return;};
this.drawMe(this.id);
};
Bug.prototype.spawnControl = function(){
if (this._isSpawning && this._posy <= this._outOfScreenThreshold)
return true;
else if (this._isSpawning)
this._isSpawning = false;
return false;
};
Bug.prototype.shouldIMoveFoward = function(){
var bounds = this.amINearWhichBounds();
if (bounds.bottom && this._rotation == 0)
return true;
if (bounds.top || bounds.bottom || bounds.left || bounds.right)
return false;
if (this._turningWhile !== 0) return false;
var chance = Math.random() * 100;
return (chance < this._fowardChance);
};
Bug.prototype.shouldITurnLeft = function(){
/*if (this._turningWhile >= 0) return false;
if (this._turningWhile < 0) return true;
*/
var chance = Math.random() * 100;
return (chance < this._turningChance);
};
Bug.prototype.shouldITurnRight = function(){
/*if (this._turningWhile <= 0) return false;
if (this._turningWhile > 0) return true;
*/
var chance = Math.random() * 100;
return (chance < this._turningChance);
};
Bug.prototype.forceMeTurnThatWay = function(){
var bounds = this.amINearWhichBounds();
var moveTo = "";
if (bounds.top || bounds.bottom || bounds.left || bounds.right)
{
this._turningWhile = 0;
var quad = (this._rotation >= 180);
if (quad && (moveTo === "") && ((bounds.top && bounds.right) || (bounds.bottom && bounds.right) || (bounds.bottom) || (bounds.bottom && bounds.left)/*180*/ || (bounds.left && bounds.top)))
moveTo = "left";
quad = (this._rotation < 180);
if (quad && (moveTo === "") && ( (bounds.bottom) || (bounds.bottom && bounds.left)))
moveTo = "left";
quad = (this._rotation < 180);
if (quad && (moveTo === "") && ((bounds.top) || (bounds.top && bounds.right) || (bounds.right) || (bounds.left && bounds.top) || (bounds.left) /*<180*/|| (bounds.bottom && bounds.right)))
moveTo = "right";
quad = (this._rotation >= 180);
if (quad && (moveTo === "") && ((bounds.top) || (bounds.right) || (bounds.left) ))
moveTo = "right";
}
return moveTo == ""?"dontMove":moveTo;
}
Bug.prototype.turnLeft = function(){
if (this._turningWhile == 0)
{
this._turningWhile = Math.floor(Math.random() * 10)+1;
}
this._turningWhile = this._turningWhile - 1;
this._rotation = this._rotation - this._rotateThreshold;
this.moveFoward();
};
Bug.prototype.turnRight = function(){
if (this._turningWhile == 0)
{
this._turningWhile = (-Math.floor(Math.random() * 10))-1;
}
this._turningWhile = this._turningWhile + 1;
this._rotation = this._rotation + this._rotateThreshold;
this.moveFoward();
};
Bug.prototype.moveFoward = function(){
var tetaX = 0;//sin
var tetaY = 0;//cos
var sin = 0;
var cos = 0;
if (this._rotation >= 360)
this._rotation = this._rotation - 360;
if (this._rotation < 0)
this._rotation = this._rotation + 360;
tetaX = 360 - this._rotation;
tetaY = this._rotation;
if (tetaX >= 360)
tetaX = tetaX - 360;
if (tetaY >= 360)
tetaY = tetaY - 360;
sin = this.sinDegrees(tetaY);
cos = this.cosDegrees(tetaX);
this._posx = this._posx + (sin * this._movePxThreshold);
this._posy =this._posy + (cos * this._movePxThreshold);
};
Bug.prototype.isBetween = function(val, min, max){
if (val > min && val < max)
return true;
return false;
};
Bug.prototype.getRandomInt = function(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}
Bug.prototype.drawMe = function(id){
var bug = document.getElementById(this.id);
bug.style.bottom = this._posy+"px";
bug.style.left = this._posx+"px";
bug.style.transform = "rotate("+this._rotation+"deg)";
};
Bug.prototype.resetMe = function(){
this._posx = this.getRandomInt(this._outOfScreenThreshold, window.innerWidth - this._outOfScreenThreshold);
this._posy = (-48);
this._rotation = 0;
this._turningWhile = 0;
this._isSpawning = true;
this._hp = 100;
this._amIDead = false;
this.drawMe(this.id);
};
Bug.prototype.setHealth = function(){
var bugHpBar = document.getElementById("hp" + this.id);
bugHpBar.parentElement.style.display = "block";
if (this._hp < 40)
bugHpBar.style.backgroundColor = "red";
else if (this._hp < 70)
bugHpBar.style.backgroundColor = "yellow";
bugHpBar.style.width = this._hp+"%";
};
Bug.prototype.getHit = function(damage){
if (this._hp <= 0)return;
this._hp = (this._hp - damage) < 0 ? 0 : (this._hp - damage);
this.setHealth();
if (this._hp == 0)
{
this._amIDead = true;
this.imDying();
}
};
Bug.prototype.imDying = function(){
var bug = document.getElementById(this.id);
self = this;
var it = setInterval(function(){
self._opacity = self._opacity - 0.1;
self._opacity = self._opacity < 0.1 ? 0 : self._opacity;
bug.style.opacity = self._opacity;
if (self._opacity < 0.00001){
bug.style.zIndex = (-1000-self.id);
clearInterval(it);
}
}, 100);
};
Bug.prototype.sinDegrees = function(angle) {return Math.sin(angle/180*Math.PI);};
Bug.prototype.cosDegrees = function(angle) {return Math.cos(angle/180*Math.PI);};
/*-----------------------------------------------------*/
function Swarm(){
var swarmLenght = 50;
var bugMoveInterval = 15;
var bugColor = 'default';
var color = 'red';
var swarm = {};
Swarm.prototype.setColor = function(cl){
color = cl;
}
Swarm.prototype.getColor = function(){
return color;
}
Swarm.prototype.setBugColor = function(cl){
bugColor = cl;
}
Swarm.prototype.getBugColor = function(){
return cl;
}
Swarm.prototype.spawnTheSwarm = function (){
var i = 0;
var tmId = 0;
tmId = setInterval(function () {
if (i < swarmLenght){
spawnABug(i);
i = i + 1;
}
else {
clearInterval(tmId);
}
}, Math.floor(Math.random() * (1000 - 10 + 1)) + 10);
};
var spawnABug = function(id){
swarm[id] = new Bug();
swarm[id].setID(id);
if (createBugElement(swarm[id]))
{
var iID = setInterval(function(){
swarm[id].move();
}, bugMoveInterval);
swarm[id].iID = iID;
}
};
var createBugElement = function(bug){
var node = document.createElement("DIV");
var img = document.createElement("IMG");
var maxHp = document.createElement("DIV");
var hp = document.createElement("DIV");
node.appendChild(img);
node.appendChild(maxHp);
node.id = bug.getID();
node.style.position = "fixed";
node.style.bottom = "-100000px";
node.style.left = "-100000px";
node.style.transform = "rotate(0deg)";
maxHp.style.position = "relative";
maxHp.style.display = "none";
maxHp.style.width = "100%";
maxHp.style.height = "5px";
maxHp.style.backgroundColor = "grey";
maxHp.appendChild(hp);
hp.id = 'hp' + node.id;
hp.style.position = "absolute";
hp.style.width = "100%";
hp.style.height = "100%";
hp.style.backgroundColor = "green";
switch (bugColor){
case 'red':
img.src = bug.getImg(true);
break;
case 'yellow':
img.src = bug.getImg();
break;
default:
if (color == 'red'){
img.src = bug.getImg(true);
color = 'yellow';
}
else {
img.src = bug.getImg();
color = 'red';
}
break;
}
node.onclick = function(){
swarm[node.id].getHit(swarm[node.id].getRandomInt(10, 40));
}
return (!!document.body.appendChild(node));
};
}
$(document).ready(function(){
$(document).on("keydown", function(e){
if (e.ctrlKey && e.shiftKey && e.keyCode == 66)/*ctrl b*/{
var swarm = new Swarm();
swarm.setBugColor('yellow');
swarm.spawnTheSwarm();
return;
}
if (e.ctrlKey && e.altKey && e.keyCode == 66)/*ctrl b*/{
var swarm = new Swarm();
swarm.setBugColor('red');
swarm.spawnTheSwarm();
return;
}
if (e.ctrlKey && e.keyCode == 66)/*ctrl b*/{
var swarm = new Swarm();
swarm.spawnTheSwarm();
}
});
});