-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpoopers.html
192 lines (187 loc) · 6.44 KB
/
poopers.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
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Poopers 💩</title>
<script src="jquery-3.2.1.min.js"></script>
<link rel="stylesheet" type="text/css" href="poopers.css">
</head>
<body>
<div class="cols">
<div id="poopen1" class="poopen"></div>
<div style="height: 600px">
<div style="margin-left: 15px">
<p><img id="poopcount" src="tinypoop.png"> Collected: <a id="counter">10</a></p>
<p>Click on a pooper to make it poop</p>
</div>
<div id="pooplist" class="pooplist">
<div class="icon">
<img id="baseturd" src="cutepoop.png">
<p>Cost: <a id="basecounter">10</a></p>
</div>
<div class="icon">
<img id="fastturd" src="cutepoopfast.png">
<p>Cost: <a id="fastcounter">30</a></p>
</div>
<div class="icon">
<img id="goldturd" src="cutepoopgold.png">
<p>Cost: <a id="goldcounter">250</a></p>
</div>
<div class="icon">
<img id="platinumturd" src="cutepoopplatinum.png">
<p>Cost: <a id="platinumcounter">1000</a></p>
</div>
<div class="icon">
<img id="paper" src="smallpaper.png">
<p>Cost: <a id="papercounter">15</a></p>
</div>
<div class="icon">
<img id="bpaper" src="smallbronzepaper.png">
<p>Cost: <a id="bronzepapercounter">300</a></p>
</div>
</div>
</div>
</div>
<div>
<p>Many thanks to Quantum for helping set up this masterpiece.</p>
<p style="font-size:6px">Created by Cthulhu</p>
</div>
<script>
$(function() {
var poopets = [];
var fpoopets = [];
var div = $('#poopen1');
var w = 507;
var normalpoops = 0;
var fastpoops = 0;
var counter = $("#counter");
var h = 524;
var nextpoop = 10;
var onscreen = 0;
function Icon(id, cost, img, text) {
this.id = $(id);
this.cost = cost;
this.img = img;
this.label = $(text);
}
Icon.prototype.buy = function() {
}
function Paper(id, cost, img, text, val, classname) {
Icon.call(this, id, cost, img, text);
this.val = val;
this.classname = classname;
var that = this;
this.id.click(function () {
usepaper(that);
});
}
Paper.prototype = Object.create(Icon.prototype);
Paper.prototype.buy = function(poops) {
}
function Dropping(sourceimg, value, classname) {
this.img = sourceimg;
this.value = value;
this.classname = classname;
}
function Baseturd(id, cost, img, text, speed, drpimg, drpcost, drpclass) {
Icon.call(this, id, cost, img, text);
var that = this;
this.id.click(function () {
addpoop(that);
});
this.speed = speed;
this.dropping = new Dropping(drpimg, drpcost, drpclass);
}
Baseturd.prototype = Object.create(Icon.prototype);
var startimg = new Baseturd("#baseturd", 10, "cutepoop.png", "#basecounter", 1, "tinypoop.png", 1, "poop");
var fastimg = new Baseturd("#fastturd", 30, "cutepoopfast.png", "#fastcounter", 2, "tinypoop.png", 1, "poop");
var goldimg = new Baseturd("#goldturd", 250, "cutepoopgold.png", "#goldcounter", 1, "tinypoopgold.png", 10, "bronzepoop");
var platinumimg = new Baseturd("#platinumturd", 1000, "cutepoopplatinum.png", "#platinumcounter", 3, "tinypoopplatinum.png", 10, "bronzepoop");
var paperimg = new Paper("#paper", 15, "paper.png", "#papercounter", 1, ".poop");
var bronzetpimg = new Paper("#bpaper", 300, "bronzepaper.png", "#bronzepapercounter", 10, ".bronzepoop");
var flushnoise = new Audio("flush.mp3");
function usepaper(paper) {
if (nextpoop < Math.round(paper.cost)) {
return;
}
nextpoop -= Math.round(paper.cost);
counter.text(nextpoop);
var ttpoop = 0;
var v = $("<img>", {
src: paper.img,
class: "tpaper"
}).appendTo(div);
v.animate({
left: "+=150",
top: "+=150"
}, 1000, "linear", function() {
$(this).remove();
div.children(paper.classname).each(function() {
$(this).remove();
ttpoop += paper.val;
onscreen -= 1;
});
nextpoop += ttpoop;
paper.buy(ttpoop);
counter.text(nextpoop);
});
}
function cleartop(poops){
for(var i = 0; i < 20; i++) {
var tmp = poops.pop();
tmp[0].remove();
clearInterval(tmp[1]);
}
}
function addpoop(pooper) {
if (nextpoop < Math.round(pooper.cost)) {
return;
}
nextpoop -= Math.round(pooper.cost);
pooper.buy();
counter.text(nextpoop);
var v = {
img: $("<img>", {
src: pooper.img,
class: "poopet"
}).appendTo(div),
dropping: pooper.dropping,
currx: Math.random() * w + 5,
curry: Math.random() * h + 5
};
v.img.css({ transition: '0s'});
v.img.animate({
left: v.currx,
top: v.curry
}, 950/pooper.speed, "linear", function() {
v.img.css({
transition: 'all '+1/pooper.speed+'s linear'
});
});
return [v.img, setInterval(function() {
movepoop(v);
}, 1000/pooper.speed)];
}
function movepoop(v) {
$("<img>", {
src: v.dropping.img,
class: v.dropping.classname
}).css({
top: v.curry + 18,
left: v.currx + 21
}).click(function() {
$(this).remove();
nextpoop += v.dropping.value;
counter.text(nextpoop);
}).appendTo(div);
v.currx = Math.random() * w + 5;
v.curry = Math.random() * h + 5;
v.img.css({
top: v.curry,
left: v.currx
});
}
});
</script>
</body>
</html>