mustachio-game 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1096 -0
- package/package.json +7 -3
package/dist/index.js
ADDED
|
@@ -0,0 +1,1096 @@
|
|
|
1
|
+
const direction = {
|
|
2
|
+
UP: 1,
|
|
3
|
+
DOWN: 2,
|
|
4
|
+
LEFT: 3,
|
|
5
|
+
RIGHT: 4,
|
|
6
|
+
NONE: 0
|
|
7
|
+
};
|
|
8
|
+
var GameObject = class {
|
|
9
|
+
acceptsCollision = !0;
|
|
10
|
+
rect;
|
|
11
|
+
objectId;
|
|
12
|
+
gameContext;
|
|
13
|
+
constructor(u, z) {
|
|
14
|
+
this.gameContext = u, this.objectId = this.generateUniqueId(), this.rect = z;
|
|
15
|
+
}
|
|
16
|
+
generateUniqueId() {
|
|
17
|
+
let u = Math.floor(Math.random() * 1e4);
|
|
18
|
+
for (; !this.gameContext.validateNewObjectId(u);) u = Math.floor(Math.random() * 1e4);
|
|
19
|
+
return u;
|
|
20
|
+
}
|
|
21
|
+
}, UpdatingGameObject = class extends GameObject {
|
|
22
|
+
acceptsCollision = !0;
|
|
23
|
+
}, MovingGameObject = class extends UpdatingGameObject {
|
|
24
|
+
speedX = 0;
|
|
25
|
+
speedY = 0;
|
|
26
|
+
onGround = !1;
|
|
27
|
+
leftRightMovement(u) {
|
|
28
|
+
this.onGround = outOfBounds(this, this.gameContext);
|
|
29
|
+
for (let z of u) this.handleCollision(z);
|
|
30
|
+
this.rect.x += this.speedX, this.onGround || (this.rect.y += this.speedY, this.speedY += this.gameContext.gravity);
|
|
31
|
+
}
|
|
32
|
+
handleCollision(z) {
|
|
33
|
+
z.collisionDirection === direction.DOWN ? (this.onGround = !0, this.rect.y = z.gameObject.rect.y - this.rect.height, this.speedY = 0) : z.collisionDirection === direction.UP ? (this.speedY = 1, this.rect.y = z.gameObject.rect.y + z.gameObject.rect.height) : z.collisionDirection === direction.LEFT ? (this.rect.x = z.gameObject.rect.x - this.rect.width, this.speedX = -Math.abs(this.speedX)) : z.collisionDirection === direction.RIGHT && (this.rect.x = z.gameObject.rect.x + z.gameObject.rect.width, this.speedX = Math.abs(this.speedX));
|
|
34
|
+
}
|
|
35
|
+
}, Player = class extends MovingGameObject {
|
|
36
|
+
ignoreUpdate = !1;
|
|
37
|
+
isDead = !1;
|
|
38
|
+
blockedDirHor = direction.NONE;
|
|
39
|
+
blockedDirVert = direction.NONE;
|
|
40
|
+
speedX = 0;
|
|
41
|
+
speedY = 0;
|
|
42
|
+
numJumps = 0;
|
|
43
|
+
gameContext;
|
|
44
|
+
constructor(u, z) {
|
|
45
|
+
super(u, z), this.gameContext = u;
|
|
46
|
+
}
|
|
47
|
+
handleGravity() {
|
|
48
|
+
this.blockedDirVert !== direction.DOWN && (this.speedY += this.gameContext.gravity, this.rect.y += this.speedY, this.rect.y + this.rect.height >= this.gameContext.gameArea.height && this.playerKill());
|
|
49
|
+
}
|
|
50
|
+
canMove(z) {
|
|
51
|
+
return !this.ignoreUpdate && !this.isDead && (this.blockedDirHor === direction.NONE || this.blockedDirHor !== z);
|
|
52
|
+
}
|
|
53
|
+
jump() {
|
|
54
|
+
this.numJumps >= 2 || (this.speedY = -14, this.numJumps++, this.blockedDirVert = direction.NONE, this.rect.y -= 5);
|
|
55
|
+
}
|
|
56
|
+
landOnGameObject(z) {
|
|
57
|
+
this.blockedDirVert = direction.DOWN, this.rect.y = z.rect.y - this.rect.height + 1, this.numJumps = 0, this.speedY = 0;
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
function collisionDetection(u, z, B) {
|
|
61
|
+
let V = u.rect, U = z.rect, W = V.x;
|
|
62
|
+
u instanceof Player || (W += B);
|
|
63
|
+
let G = U.x;
|
|
64
|
+
return z instanceof Player || (G += B), W < G + U.width && W + V.width > G && V.y < U.y + U.height && V.y + V.height > U.y;
|
|
65
|
+
}
|
|
66
|
+
function getCollisionDirection(z, B, V) {
|
|
67
|
+
if (!collisionDetection(z, B, V)) return null;
|
|
68
|
+
let W = z.rect, G = B.rect, K = W.x;
|
|
69
|
+
z instanceof Player || (K += V);
|
|
70
|
+
let q = G.x;
|
|
71
|
+
B instanceof Player || (q += V);
|
|
72
|
+
let J = K + W.width / 2 - (q + G.width / 2), Y = W.y + W.height / 2 - (G.y + G.height / 2), X = (W.width + G.width) / 2, Z = (W.height + G.height) / 2, Q = X * Y, $ = Z * J;
|
|
73
|
+
return Math.abs(J) <= X && Math.abs(Y) <= Z ? Q > $ ? Q > -$ ? direction.UP : direction.LEFT : Q > -$ ? direction.RIGHT : direction.DOWN : null;
|
|
74
|
+
}
|
|
75
|
+
function getReverseDirection(z) {
|
|
76
|
+
switch (z) {
|
|
77
|
+
case direction.UP: return direction.DOWN;
|
|
78
|
+
case direction.DOWN: return direction.UP;
|
|
79
|
+
case direction.LEFT: return direction.RIGHT;
|
|
80
|
+
case direction.RIGHT: return direction.LEFT;
|
|
81
|
+
default: return direction.NONE;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
function outOfBounds(u, z) {
|
|
85
|
+
let B = z.gameArea.width * 2, V = -z.gameArea.width / 2, U = z.gameArea.height, W = -z.gameArea.height / 2, G = u.rect.x;
|
|
86
|
+
return u instanceof Player || (G += z.xOffset), G + u.rect.width < V || G > B || u.rect.y + u.rect.height < W || u.rect.y > U;
|
|
87
|
+
}
|
|
88
|
+
var RotatingGameObject = class extends UpdatingGameObject {
|
|
89
|
+
rotation = 0;
|
|
90
|
+
rotationSpeed = .01;
|
|
91
|
+
hitDetection(u, z) {
|
|
92
|
+
let B = this.rect.x + this.rect.width / 2 + this.gameContext.xOffset, V = this.rect.y + this.rect.height, H = u - B, U = z - V, W = Math.sin(-this.rotation), G = Math.cos(-this.rotation), K = H * G - U * W, q = H * W + U * G, J = this.rect.width / 2, Y = this.rect.height;
|
|
93
|
+
return K >= -J && K <= J && q >= -Y && q <= 0;
|
|
94
|
+
}
|
|
95
|
+
hitDirection(z, B) {
|
|
96
|
+
let V = this.rect.x + this.rect.width / 2, H = this.rect.y + this.rect.height, U = z - V, W = B - H, G = Math.sin(-this.rotation), K = Math.cos(-this.rotation), q = U * K - W * G;
|
|
97
|
+
return U * G + W * K < 0 ? direction.UP : q < 0 ? direction.LEFT : q > 0 ? direction.RIGHT : direction.DOWN;
|
|
98
|
+
}
|
|
99
|
+
}, UIObject = class extends GameObject {
|
|
100
|
+
constructor(u, z, B) {
|
|
101
|
+
super(u, {
|
|
102
|
+
x: z,
|
|
103
|
+
y: B,
|
|
104
|
+
width: 0,
|
|
105
|
+
height: 0
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
}, WinDisplay = class extends UIObject {
|
|
109
|
+
constructor(u) {
|
|
110
|
+
super(u, u.gameArea.width / 2, u.gameArea.height / 2 - 50);
|
|
111
|
+
}
|
|
112
|
+
draw(u) {
|
|
113
|
+
u.fillStyle = "white", u.font = "80px Arial";
|
|
114
|
+
let z = `You win! Score: ${this.gameContext.score}`, B = u.measureText(z).width;
|
|
115
|
+
u.fillText(z, this.rect.x + this.rect.width / 2 - B / 2, this.rect.y + this.rect.height);
|
|
116
|
+
}
|
|
117
|
+
}, GameContext = class {
|
|
118
|
+
score = 0;
|
|
119
|
+
currentDir = direction.NONE;
|
|
120
|
+
time = 300;
|
|
121
|
+
xOffset = 0;
|
|
122
|
+
gravity = .6;
|
|
123
|
+
gameArea;
|
|
124
|
+
ui;
|
|
125
|
+
bg;
|
|
126
|
+
uiContext;
|
|
127
|
+
gameContext;
|
|
128
|
+
bgContext;
|
|
129
|
+
xSpeed;
|
|
130
|
+
walkSpeed;
|
|
131
|
+
sprintSpeed;
|
|
132
|
+
mainLoop = null;
|
|
133
|
+
timerLoop = null;
|
|
134
|
+
isStatic = !1;
|
|
135
|
+
gameOver = !1;
|
|
136
|
+
pressedKeys = [];
|
|
137
|
+
gameObjects = [];
|
|
138
|
+
uiObjects = [];
|
|
139
|
+
bgObjects = [];
|
|
140
|
+
constructor(u) {
|
|
141
|
+
window.innerWidth <= 1e3 ? this.walkSpeed = 14 : this.walkSpeed = 7, this.xSpeed = this.walkSpeed, this.sprintSpeed = 14;
|
|
142
|
+
let { gameCanvas: z, bgCanvas: B, uiCanvas: V } = this.createGameArea(u), H = this.setupCanvas(z);
|
|
143
|
+
this.gameArea = H.canvas, this.gameContext = H.context, H = this.setupCanvas(V), this.ui = H.canvas, this.uiContext = H.context, H = this.setupCanvas(B), this.bg = H.canvas, this.bgContext = H.context, window.addEventListener("keydown", (u) => this.onKeyDown(u)), window.addEventListener("keyup", (u) => this.onKeyUp(u));
|
|
144
|
+
}
|
|
145
|
+
getPlayer() {
|
|
146
|
+
return this.player;
|
|
147
|
+
}
|
|
148
|
+
addScore(u) {
|
|
149
|
+
this.score += u, this.scoreDisplay.draw(this.uiContext);
|
|
150
|
+
}
|
|
151
|
+
setPlayerLocation(u, z) {
|
|
152
|
+
this.isStatic ? this.player.reset(u, z) : (this.player.reset(void 0, z), this.xOffset = -u);
|
|
153
|
+
}
|
|
154
|
+
startMainLoop() {
|
|
155
|
+
this.mainLoop && clearInterval(this.mainLoop), this.mainLoop = setInterval(() => {
|
|
156
|
+
this.updateGameArea();
|
|
157
|
+
}, 20), this.timerLoop && clearInterval(this.timerLoop), this.timerLoop = setInterval(() => {
|
|
158
|
+
this.timerTick();
|
|
159
|
+
}, 1e3);
|
|
160
|
+
}
|
|
161
|
+
stopMainLoop() {
|
|
162
|
+
this.mainLoop &&= (clearInterval(this.mainLoop), null), this.timerLoop &&= (clearInterval(this.timerLoop), null);
|
|
163
|
+
}
|
|
164
|
+
clearLevel() {
|
|
165
|
+
this.isStatic = !1, this.xOffset = 0, this.stopMainLoop();
|
|
166
|
+
for (let u of this.gameObjects) "dispose" in u && typeof u.dispose == "function" && u.dispose();
|
|
167
|
+
this.gameObjects.splice(0, this.gameObjects.length), this.addGameObject(this.player);
|
|
168
|
+
}
|
|
169
|
+
setStatic(u) {
|
|
170
|
+
this.isStatic = u;
|
|
171
|
+
}
|
|
172
|
+
setGameOver() {
|
|
173
|
+
this.currentDir = direction.NONE, this.gameOver = !0, this.stopTimer();
|
|
174
|
+
}
|
|
175
|
+
addGameObject(u, z = !1) {
|
|
176
|
+
this.gameObjects.find((z) => z.objectId === u.objectId) || (z ? this.gameObjects.unshift(u) : this.gameObjects.push(u));
|
|
177
|
+
}
|
|
178
|
+
addUIObject(u) {
|
|
179
|
+
this.uiObjects.push(u);
|
|
180
|
+
}
|
|
181
|
+
addBgObject(u) {
|
|
182
|
+
this.bgObjects.push(u), u.draw(this.bgContext);
|
|
183
|
+
}
|
|
184
|
+
removeGameObject(u) {
|
|
185
|
+
let z = this.gameObjects.findIndex((z) => z.objectId === u.objectId);
|
|
186
|
+
z > -1 && this.gameObjects.splice(z, 1);
|
|
187
|
+
}
|
|
188
|
+
removeUIObject(u) {
|
|
189
|
+
let z = this.uiObjects.findIndex((z) => z.objectId === u.objectId);
|
|
190
|
+
z > -1 && this.uiObjects.splice(z, 1);
|
|
191
|
+
}
|
|
192
|
+
removeBgObject(u) {
|
|
193
|
+
let z = this.bgObjects.findIndex((z) => z.objectId === u.objectId);
|
|
194
|
+
z > -1 && this.bgObjects.splice(z, 1);
|
|
195
|
+
}
|
|
196
|
+
restart(u) {
|
|
197
|
+
this.stopMainLoop(), this.gameObjects.splice(0, this.gameObjects.length), u(this);
|
|
198
|
+
}
|
|
199
|
+
validateNewObjectId(u) {
|
|
200
|
+
return this.gameObjects.find((z) => z.objectId === u) === void 0;
|
|
201
|
+
}
|
|
202
|
+
stopTimer() {
|
|
203
|
+
this.timerLoop &&= (clearInterval(this.timerLoop), null);
|
|
204
|
+
}
|
|
205
|
+
clear() {
|
|
206
|
+
this.gameContext.clearRect(0, 0, this.gameArea.width, this.gameArea.height);
|
|
207
|
+
}
|
|
208
|
+
updateGameArea() {
|
|
209
|
+
this.clear();
|
|
210
|
+
let z = this.getGameObjectsToUpdate(), V = this.getGameObjectsWithCollisions(z);
|
|
211
|
+
this.gameOver && this.player.update([]);
|
|
212
|
+
for (let u of z) {
|
|
213
|
+
if (!this.gameOver && u instanceof UpdatingGameObject) {
|
|
214
|
+
let z = V.get(u.objectId);
|
|
215
|
+
u.update(z ?? []);
|
|
216
|
+
}
|
|
217
|
+
u.draw(this.gameContext);
|
|
218
|
+
}
|
|
219
|
+
for (let u of this.uiObjects) u.draw(this.uiContext);
|
|
220
|
+
let H = this.player.canMove(this.currentDir);
|
|
221
|
+
this.gameOver || !H || (this.isStatic ? this.currentDir === direction.RIGHT ? this.player.rect.x -= this.xSpeed : this.currentDir === direction.LEFT && (this.player.rect.x += this.xSpeed) : this.currentDir === direction.RIGHT ? this.xOffset += this.xSpeed : this.currentDir === direction.LEFT && (this.xOffset -= this.xSpeed));
|
|
222
|
+
}
|
|
223
|
+
onKeyDown(z) {
|
|
224
|
+
if (this.gameOver || z.repeat) return;
|
|
225
|
+
let B = z.key.toLocaleLowerCase().trim();
|
|
226
|
+
B === "p" && (this.mainLoop ? this.stopMainLoop() : this.startMainLoop()), this.mainLoop !== null && (this.pressedKeys.includes(B) || (this.pressedKeys.push(B), this.player.customKeyDown(B), B === "arrowleft" || B === "a" ? this.currentDir = direction.RIGHT : B === "arrowright" || B === "d" ? this.currentDir = direction.LEFT : B === "arrowup" || B === "w" ? this.player.jump() : B === "shift" && (this.xSpeed = this.sprintSpeed)));
|
|
227
|
+
}
|
|
228
|
+
onKeyUp(z) {
|
|
229
|
+
if (this.gameOver) return;
|
|
230
|
+
let B = z.key.toLocaleLowerCase();
|
|
231
|
+
this.pressedKeys.splice(this.pressedKeys.findIndex((u) => u === B), 1), this.player.customKeyUp(B), B === "arrowleft" || B === "a" || B === "arrowright" || B === "d" ? this.pressedKeys.includes("arrowleft") || this.pressedKeys.includes("a") ? this.currentDir = direction.RIGHT : this.pressedKeys.includes("arrowright") || this.pressedKeys.includes("d") ? this.currentDir = direction.LEFT : this.currentDir = direction.NONE : B === "shift" && (this.xSpeed = this.walkSpeed);
|
|
232
|
+
}
|
|
233
|
+
createGameArea(u) {
|
|
234
|
+
let z = document.getElementById(u);
|
|
235
|
+
if (!z) throw Error(`Container with id ${u} not found`);
|
|
236
|
+
z.innerHTML = "", z.style.position = "relative";
|
|
237
|
+
let { width: B, height: V } = z.getBoundingClientRect(), H = document.createElement("canvas");
|
|
238
|
+
H.id = "background-layer", H.style.position = "absolute", H.style.inset = "0", H.style.width = `${B}px`, H.style.height = `${V}px`, z.appendChild(H);
|
|
239
|
+
let U = document.createElement("canvas");
|
|
240
|
+
U.id = "game-layer", U.style.position = "absolute", U.style.inset = "0", U.style.width = `${B}px`, U.style.height = `${V}px`, z.appendChild(U);
|
|
241
|
+
let W = document.createElement("canvas");
|
|
242
|
+
return W.id = "ui-layer", W.style.position = "absolute", W.style.inset = "0", W.style.width = `${B}px`, W.style.height = `${V}px`, z.appendChild(W), {
|
|
243
|
+
gameCanvas: U,
|
|
244
|
+
bgCanvas: H,
|
|
245
|
+
uiCanvas: W
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
setupCanvas(u) {
|
|
249
|
+
return u.width = 1920, u.height = 1080, {
|
|
250
|
+
canvas: u,
|
|
251
|
+
context: u.getContext("2d")
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
timerTick() {
|
|
255
|
+
this.time--, this.timeDisplay.draw(this.uiContext), this.time <= 0 && (this.timerLoop &&= (clearInterval(this.timerLoop), null), this.isStatic = !0, this.player.playerKill());
|
|
256
|
+
}
|
|
257
|
+
getGameObjectsToUpdate() {
|
|
258
|
+
return this.gameObjects.filter((u) => !outOfBounds(u, this));
|
|
259
|
+
}
|
|
260
|
+
getGameObjectsWithCollisions(u) {
|
|
261
|
+
let z = /* @__PURE__ */ new Map();
|
|
262
|
+
for (let B of u) B.acceptsCollision && this.getCollisionForGameObject(B, u, z);
|
|
263
|
+
return z;
|
|
264
|
+
}
|
|
265
|
+
getCollisionForGameObject(u, z, B) {
|
|
266
|
+
for (let V of z) V.acceptsCollision && this.getCollisionForGameObjects(u, V, B);
|
|
267
|
+
}
|
|
268
|
+
getCollisionForGameObjects(u, z, B) {
|
|
269
|
+
if (u.objectId === z.objectId) return;
|
|
270
|
+
if (!B.has(u.objectId)) B.set(u.objectId, []);
|
|
271
|
+
else {
|
|
272
|
+
let V = B.get(u.objectId);
|
|
273
|
+
if (V && V.find((u) => u.gameObject.objectId === z.objectId)) return;
|
|
274
|
+
}
|
|
275
|
+
let V = this.getCollisionDirectionForGameObjects(u, z);
|
|
276
|
+
if (V !== null) {
|
|
277
|
+
let H = {
|
|
278
|
+
gameObject: z,
|
|
279
|
+
collisionDirection: V
|
|
280
|
+
}, U = {
|
|
281
|
+
gameObject: u,
|
|
282
|
+
collisionDirection: getReverseDirection(V)
|
|
283
|
+
}, W = B.get(u.objectId);
|
|
284
|
+
W ? (W.push(H), B.set(u.objectId, W)) : B.set(u.objectId, [H]);
|
|
285
|
+
let K = B.get(z.objectId);
|
|
286
|
+
K ? (K.push(U), B.set(z.objectId, K)) : B.set(z.objectId, [U]);
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
getCollisionDirectionForGameObjects(z, B) {
|
|
290
|
+
let V = null;
|
|
291
|
+
return z instanceof RotatingGameObject ? B instanceof Player && z.hitDetection(B.rect.x, B.rect.y) && (V = direction.NONE) : B instanceof RotatingGameObject ? z instanceof Player && B.hitDetection(z.rect.x, z.rect.y) && (V = direction.NONE) : V = getCollisionDirection(z, B, this.xOffset), V;
|
|
292
|
+
}
|
|
293
|
+
win() {
|
|
294
|
+
this.addUIObject(new WinDisplay(this));
|
|
295
|
+
}
|
|
296
|
+
}, SetPiece = class extends GameObject {}, Obstacle = class extends SetPiece {}, Block = class extends Obstacle {
|
|
297
|
+
constructor(u, z, B) {
|
|
298
|
+
super(u, {
|
|
299
|
+
x: z,
|
|
300
|
+
y: B,
|
|
301
|
+
width: 60,
|
|
302
|
+
height: 60
|
|
303
|
+
});
|
|
304
|
+
}
|
|
305
|
+
}, obstacleBrick_default = "data:image/webp;base64,UklGRvQAAABXRUJQVlA4IOgAAAAQBwCdASomACYAPpFAmUklo6IhJzgNsLASCUAWyQMHQfgEmAD0Gh2a3DmzlIZr7nrwL9jMvaMhLzhSb1EHCIYeAAD+72RdweWMmfG1d++fgYxllF/QV/Ck3mpGf6pI4Mrfx+FTnU54SBT9FlY3/MiiBb0qGEYxcYRHm6qDlpdBN54SsroE2JDLOgpCF63QlGNeANKlT9oWXzSmpfDC8KcUSQp8juH95nYNfhPPDP9AErrAiK7hHvpA/lDsJxIzgXzskRIiLARSueuugglUJt/SMp4JMHVUOBf2Nhxradx3ltqxwlaAAAAA", Wall = class extends Block {
|
|
306
|
+
image = new Image();
|
|
307
|
+
constructor(u, z, B) {
|
|
308
|
+
super(u, z, B), this.image.src = obstacleBrick_default;
|
|
309
|
+
}
|
|
310
|
+
draw(u) {
|
|
311
|
+
u.drawImage(this.image, this.rect.x + this.gameContext.xOffset, this.rect.y, this.rect.width, this.rect.height);
|
|
312
|
+
}
|
|
313
|
+
}, PointObject = class extends MovingGameObject {
|
|
314
|
+
collect() {
|
|
315
|
+
this.gameContext.addScore(this.pointValue), this.gameContext.removeGameObject(this);
|
|
316
|
+
}
|
|
317
|
+
}, Item = class extends PointObject {
|
|
318
|
+
fromItemBlock;
|
|
319
|
+
constructor(u, z, B = !1) {
|
|
320
|
+
B && (z.x -= z.width / 2, z.y += 60), super(u, z), this.fromItemBlock = B, B && (this.speedY = -.5);
|
|
321
|
+
}
|
|
322
|
+
}, Coin = class extends Item {
|
|
323
|
+
pointValue = 100;
|
|
324
|
+
constructor(u, z, B, V = !1) {
|
|
325
|
+
let H = {
|
|
326
|
+
x: z,
|
|
327
|
+
y: B,
|
|
328
|
+
width: 15,
|
|
329
|
+
height: 15
|
|
330
|
+
};
|
|
331
|
+
V || (H.x += 60 / 2 - H.width / 2, H.y += 60 / 2 - H.height / 2), super(u, H, V), V && (this.speedY = -2.5);
|
|
332
|
+
}
|
|
333
|
+
update(u) {
|
|
334
|
+
if (this.fromItemBlock) {
|
|
335
|
+
if (this.speedY < 0) {
|
|
336
|
+
this.rect.y += this.speedY, this.speedY += .1;
|
|
337
|
+
return;
|
|
338
|
+
}
|
|
339
|
+
this.collect();
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
draw(u) {
|
|
343
|
+
u.fillStyle = "gold", u.beginPath(), u.arc(this.rect.x + this.rect.width / 2 + this.gameContext.xOffset, this.rect.y + this.rect.height / 2, this.rect.width, 0, Math.PI * 2), u.fill(), u.closePath(), u.strokeStyle = "black", u.lineWidth = 1, u.stroke();
|
|
344
|
+
}
|
|
345
|
+
}, PunchableBlock = class extends Block {}, Projectile = class extends MovingGameObject {}, BrickDebris = class extends Projectile {
|
|
346
|
+
acceptsCollision = !1;
|
|
347
|
+
constructor(u, z) {
|
|
348
|
+
super(u, {
|
|
349
|
+
x: z.rect.x + z.rect.width / 2,
|
|
350
|
+
y: z.rect.y + z.rect.height / 2,
|
|
351
|
+
width: 8,
|
|
352
|
+
height: 8
|
|
353
|
+
});
|
|
354
|
+
}
|
|
355
|
+
update(u) {
|
|
356
|
+
this.rect.x += this.speedX, this.rect.y += this.speedY, this.speedY += this.gameContext.gravity, this.rect.y > this.gameContext.gameArea.height && this.gameContext.removeGameObject(this);
|
|
357
|
+
}
|
|
358
|
+
draw(u) {
|
|
359
|
+
u.fillStyle = "brown", u.beginPath(), u.arc(this.rect.x + this.rect.width / 2 + this.gameContext.xOffset, this.rect.y + this.rect.height / 2, this.rect.width, 0, Math.PI * 2), u.fill(), u.closePath();
|
|
360
|
+
}
|
|
361
|
+
}, brick_default = "data:image/webp;base64,UklGRswAAABXRUJQVlA4IMAAAAAQBgCdASonACYAPpFAmkolo6Iho4z4sBIJZQC7M5vPMtVAMAOd6GoEpdxIkh6zl4EwMLtdrmL1YFAA/uv/5J4XO4frT8G9RsDxsNP6LhxxicoeRzh+/mlU2ixUHe/8HuBD1OZB0p5MtBlsarKj/iFDfe0mYDJZzEDZ+AwtoP+S4xYTce2ZkeQuDAIcNPGOWQgCcHWqJgCoCOsynyg07mNvUetkl4Vfsw5nMI2VBCy4PCXKkdZaJYAwSvxnBuAAAAA=", Brick = class extends PunchableBlock {
|
|
362
|
+
punched = !1;
|
|
363
|
+
image = new Image();
|
|
364
|
+
constructor(u, z, B) {
|
|
365
|
+
super(u, z, B), this.image.src = brick_default;
|
|
366
|
+
}
|
|
367
|
+
punch() {
|
|
368
|
+
if (this.punched) return;
|
|
369
|
+
this.punched = !0, this.gameContext.addScore(100);
|
|
370
|
+
let u = [
|
|
371
|
+
-1,
|
|
372
|
+
-2.5,
|
|
373
|
+
1,
|
|
374
|
+
2.5
|
|
375
|
+
], z = [
|
|
376
|
+
-2,
|
|
377
|
+
-3.5,
|
|
378
|
+
-2,
|
|
379
|
+
-3.5
|
|
380
|
+
];
|
|
381
|
+
for (let B = 0; B < 4; B++) {
|
|
382
|
+
let V = new BrickDebris(this.gameContext, this);
|
|
383
|
+
V.speedX = u[B], V.speedY = z[B], this.gameContext.addGameObject(V);
|
|
384
|
+
}
|
|
385
|
+
this.gameContext.removeGameObject(this);
|
|
386
|
+
}
|
|
387
|
+
draw(u) {
|
|
388
|
+
u.drawImage(this.image, this.rect.x + this.gameContext.xOffset, this.rect.y, this.rect.width, this.rect.height);
|
|
389
|
+
}
|
|
390
|
+
}, FallingFloor = class extends Block {
|
|
391
|
+
isFalling = !1;
|
|
392
|
+
fallStarted = !1;
|
|
393
|
+
startFall() {
|
|
394
|
+
this.fallStarted || (this.fallStarted = !0, setTimeout(() => {
|
|
395
|
+
this.acceptsCollision = !1, this.isFalling = !0;
|
|
396
|
+
}, 250));
|
|
397
|
+
}
|
|
398
|
+
draw(u) {
|
|
399
|
+
this.isFalling && (this.rect.y += 5, this.rect.y > this.gameContext.gameArea.height && this.gameContext.removeGameObject(this)), u.fillStyle = "Bisque", u.fillRect(this.rect.x + this.gameContext.xOffset, this.rect.y, this.rect.width, this.rect.height);
|
|
400
|
+
let z = {
|
|
401
|
+
x: this.rect.x + 60 / 3 + this.gameContext.xOffset,
|
|
402
|
+
y: this.rect.y + 60 / 3,
|
|
403
|
+
width: this.rect.width - 60 / 3 * 2,
|
|
404
|
+
height: this.rect.height - 60 / 3 * 2
|
|
405
|
+
};
|
|
406
|
+
u.clearRect(z.x, z.y, z.width, z.height), u.strokeStyle = "black", u.lineWidth = 2, u.strokeRect(z.x, z.y, z.width, z.height), u.strokeRect(this.rect.x, this.rect.y, this.rect.width, this.rect.height);
|
|
407
|
+
}
|
|
408
|
+
};
|
|
409
|
+
function createBlockWall(u, z, B, V, H, U) {
|
|
410
|
+
for (let W = 0; W < V; W++) for (let V = 0; V < H; V++) {
|
|
411
|
+
let H = (z + W) * 60, G = (B + V) * 60;
|
|
412
|
+
U === "wall" ? u.addGameObject(new Wall(u, H, G)) : U === "brick" ? u.addGameObject(new Brick(u, H, G)) : U === "coin" ? u.addGameObject(new Coin(u, H, G)) : U === "falling-floor" && u.addGameObject(new FallingFloor(u, H, G));
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
function createBlockPyramid(u, z, B, V, H) {
|
|
416
|
+
for (; V > 0;) createBlockWall(u, z, B, V, 1, H), z += 1, --B, V -= 2;
|
|
417
|
+
}
|
|
418
|
+
function createBlockSquare(u, z, B, V, H, U) {
|
|
419
|
+
createBlockWall(u, z, B, V, 1, U), createBlockWall(u, z, B + H - 1, V, 1, U), createBlockWall(u, z, B + 1, 1, H - 2, U), createBlockWall(u, z + V - 1, B + 1, 1, H - 2, U);
|
|
420
|
+
}
|
|
421
|
+
var Floor = class extends Obstacle {
|
|
422
|
+
draw(u) {
|
|
423
|
+
u.fillStyle = "YellowGreen";
|
|
424
|
+
let z = {
|
|
425
|
+
x: this.rect.x + this.gameContext.xOffset,
|
|
426
|
+
y: this.rect.y,
|
|
427
|
+
width: this.rect.width,
|
|
428
|
+
height: 60 / 3
|
|
429
|
+
}, B = {
|
|
430
|
+
x: this.rect.x + this.gameContext.xOffset,
|
|
431
|
+
y: this.rect.y + 60 / 3,
|
|
432
|
+
width: this.rect.width,
|
|
433
|
+
height: 60 - 60 / 3
|
|
434
|
+
};
|
|
435
|
+
u.fillRect(z.x, z.y, z.width, z.height), u.fillStyle = "SaddleBrown", u.fillRect(B.x, B.y, B.width, B.height);
|
|
436
|
+
}
|
|
437
|
+
}, Stacheroom = class extends Item {
|
|
438
|
+
pointValue = 1e3;
|
|
439
|
+
totalRaise = 20;
|
|
440
|
+
speedX = 2;
|
|
441
|
+
constructor(u, z, B, V = !1) {
|
|
442
|
+
super(u, {
|
|
443
|
+
x: z,
|
|
444
|
+
y: B,
|
|
445
|
+
width: 20,
|
|
446
|
+
height: 20
|
|
447
|
+
}, V);
|
|
448
|
+
}
|
|
449
|
+
draw(u) {
|
|
450
|
+
u.fillStyle = "blue", u.fillRect(this.rect.x + this.gameContext.xOffset, this.rect.y, this.rect.width, this.rect.height);
|
|
451
|
+
}
|
|
452
|
+
update(u) {
|
|
453
|
+
if (this.fromItemBlock && this.totalRaise > 0) {
|
|
454
|
+
this.rect.y += this.speedY, this.totalRaise += this.speedY;
|
|
455
|
+
return;
|
|
456
|
+
}
|
|
457
|
+
this.leftRightMovement(u);
|
|
458
|
+
}
|
|
459
|
+
}, FireStache = class extends Item {
|
|
460
|
+
pointValue = 1e3;
|
|
461
|
+
totalRaise = 20;
|
|
462
|
+
speedX = 2;
|
|
463
|
+
constructor(u, z, B, V = !1) {
|
|
464
|
+
super(u, {
|
|
465
|
+
x: z,
|
|
466
|
+
y: B,
|
|
467
|
+
width: 20,
|
|
468
|
+
height: 20
|
|
469
|
+
}, V);
|
|
470
|
+
}
|
|
471
|
+
draw(u) {
|
|
472
|
+
u.fillStyle = "red", u.fillRect(this.rect.x + this.gameContext.xOffset, this.rect.y, this.rect.width, this.rect.height);
|
|
473
|
+
}
|
|
474
|
+
update(u) {
|
|
475
|
+
if (this.fromItemBlock && this.totalRaise > 0) {
|
|
476
|
+
this.rect.y += this.speedY, this.totalRaise += this.speedY;
|
|
477
|
+
return;
|
|
478
|
+
}
|
|
479
|
+
this.leftRightMovement(u);
|
|
480
|
+
}
|
|
481
|
+
}, itemBlock_default = "data:image/webp;base64,UklGRkIBAABXRUJQVlA4IDYBAACwBwCdASoeAB4APpE+m0kloyKhKAqosBIJbACdMzQ6eL6sJABtgNwBvIG8t/sOTSfxukHyOWc+E1LmDlG35iKXOajJYc6gAP7tWrgGIcr6MvxzKBZxLQARijF/K/uDPoaaImFsPB3PT9DTTrtgklbiWxZ5DY9/j+wdSEkQDN9/9OKN097qT9jxv/HBwYeb2SsOwVjJ4iGDxPBGX71uLKOCSjvVHiu/S8P2G/w8HFg2e95io1yqX68jsr2lnn/vRsVVnTa2by/tS+WCejX31AdvP921XOEHsyV4LHuWxWaz2dT+Ww6B2YtaAWYj+qc/8GxpR+YxknvPYRGb+pGCXQQOEJ5ZLQAnzrWe7tkoyJMdgnqButyeEccjScBe8Vt/q9pzc97Bnd6cjURxwYn2Xkq22ZAoAAAA", punchedBlock_default = "data:image/webp;base64,UklGRnoAAABXRUJQVlA4IG4AAACwBACdASoeAB4APpFCnEolo6KhqAgAsBIJYwCsMscGBzKrb44WiJpXCEek0OJAAN/Ln2U/xYsYy4Lb16/rp3d+J8jzmm2U/9X15I59iCDiQvZyaMdx3ji68hmuqNG1gTjFl4YkL+LhEBjmYyQAAA==", ItemBlock = class extends PunchableBlock {
|
|
482
|
+
punched = !1;
|
|
483
|
+
hidden;
|
|
484
|
+
image = new Image();
|
|
485
|
+
imageSource = itemBlock_default;
|
|
486
|
+
imageSourcePunched = punchedBlock_default;
|
|
487
|
+
item;
|
|
488
|
+
constructor(u, z, B, V, H) {
|
|
489
|
+
switch (super(u, z, B), this.image.src = this.imageSource, this.hidden = V, H) {
|
|
490
|
+
case "coin":
|
|
491
|
+
this.item = Coin;
|
|
492
|
+
break;
|
|
493
|
+
case "stacheroom":
|
|
494
|
+
this.item = Stacheroom;
|
|
495
|
+
break;
|
|
496
|
+
case "fire-stache":
|
|
497
|
+
this.item = FireStache;
|
|
498
|
+
break;
|
|
499
|
+
default: throw Error(`Unknown item type: ${H}`);
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
punch() {
|
|
503
|
+
if (this.punched) return;
|
|
504
|
+
this.punched = !0, this.hidden = !1, this.image.src = this.imageSourcePunched;
|
|
505
|
+
let u = new this.item(this.gameContext, this.rect.x + this.rect.width / 2, this.rect.y - this.rect.height, !0);
|
|
506
|
+
this.gameContext.addGameObject(u, !0);
|
|
507
|
+
}
|
|
508
|
+
draw(u) {
|
|
509
|
+
this.hidden || u.drawImage(this.image, this.rect.x + this.gameContext.xOffset, this.rect.y, this.rect.width, this.rect.height);
|
|
510
|
+
}
|
|
511
|
+
}, Enemy = class extends PointObject {
|
|
512
|
+
isDead = !1;
|
|
513
|
+
image = new Image();
|
|
514
|
+
imageSources = [];
|
|
515
|
+
imageSourceIndex = 0;
|
|
516
|
+
shotTimer = null;
|
|
517
|
+
imageTimer = null;
|
|
518
|
+
constructor(u, z, B = !0) {
|
|
519
|
+
super(u, z), B && (this.imageTimer = setInterval(() => {
|
|
520
|
+
this.setNextImage();
|
|
521
|
+
}, 250));
|
|
522
|
+
}
|
|
523
|
+
setNextImage() {
|
|
524
|
+
this.imageSourceIndex++, this.imageSourceIndex >= this.imageSources.length && (this.imageSourceIndex = 0), this.image.src = this.imageSources[this.imageSourceIndex];
|
|
525
|
+
}
|
|
526
|
+
enemyHit() {
|
|
527
|
+
this.isDead || (this.isDead = !0, this.speedX = 0, this.speedY = 0, this.rect.y += this.rect.height / 2, this.rect.height /= 2, this.gameContext.addScore(this.pointValue), setTimeout(() => {
|
|
528
|
+
this.gameContext.removeGameObject(this);
|
|
529
|
+
}, 500));
|
|
530
|
+
}
|
|
531
|
+
dispose() {
|
|
532
|
+
this.shotTimer &&= (clearTimeout(this.shotTimer), clearInterval(this.shotTimer), null), this.imageTimer &&= (clearInterval(this.imageTimer), null);
|
|
533
|
+
}
|
|
534
|
+
}, stacheStalker_default = "data:image/webp;base64,UklGRnQBAABXRUJQVlA4IGgBAABQBwCdASomACYAPpE8m0mloyKhKrqpWLASCWYAwfuhyxLYHUQbywjQQimq1TIAe8mQMrghS77uVJkfXHokNV6IwcvgANaFuqxVinHaCOH44zwGRWU6JwUTsh7rKHhturreY/sXNU5/cNRkimZelXP1X/V0Hkarb+W3xQyT1xkHyYSMlybPF1pqLLXjvX/19YqXVlGv4tlUmbRONXvHgdgrX1p3VIkJwfvPbnC5WH8JDJfXnJ3tmpvovAN3rPk8J4hFxRvmzGSk3XLNtyq+9//V54UMlfPsayfWsn6tzjederOcFrTO6bue3IA+D6abi0NFTEr1t017ojRpESjfbYL7dGBMN8D2GRPmT1OysZOtph4dBZKx4rR69tubY2EFIezy3eCNnprjUhKQUB0qyrXfCw0p16HAjF7NcasUyhuEm+9IHUFGI6H/KbpUBnu3kdBC1y529GsgteORZCnB2QxDMNxPYAAAAAA=", stacheStalkerReversed_default = "data:image/webp;base64,UklGRnwBAABXRUJQVlA4IHABAACwCACdASomACYAPpFAnEmlo6MhJzgLaLASCWQAzQPTmKbYDnqujA6iveUivaDJPF29VE+8dzijy5qCoSSBijPU4xHeL3MtgcipZrJxQwAAz83Bh7fyWIq1gLQKl/f4um81jpk5TrLniv8WyfOQZ7AGbMsH2N2GdW72AncpdpNB3ASPFBn4Gs9/9CtXaOxRsknLf/1d6o8vaDerGytutnQVsqYot8sls9mOzY98CDvVogrd6asmDyY79RUTjUgPwBgC/Sd6Pq5DQGbAfXo419T1M9oECC0+/2XcdbhiPPxaPKB3UpVZwaQFk1rKU0h23vQckuYUK1MZAhYB/xh0+hAeIjM2dRGF/rQnpkmrBAJxw/WES6IC/af3S0rHr5qv++RZZ1lCsp1gdQX5i67d278mxQRtBSw1EM/jMx7R/Mja7R53tBbMLiwbhuVjVUri4VB9i6kfg+b8q0Diw+5VKZaljxLAeQpwaAHRQ4jOAAAAAA==", StacheStalker = class extends Enemy {
|
|
535
|
+
pointValue = 100;
|
|
536
|
+
constructor(u, z, B) {
|
|
537
|
+
super(u, {
|
|
538
|
+
x: z,
|
|
539
|
+
y: B,
|
|
540
|
+
width: 60 * .75,
|
|
541
|
+
height: 60 * .75
|
|
542
|
+
}), this.imageSources.push(stacheStalker_default, stacheStalkerReversed_default), this.image.src = this.imageSources[0], this.speedX = 1;
|
|
543
|
+
}
|
|
544
|
+
draw(u) {
|
|
545
|
+
u.drawImage(this.image, this.rect.x + this.gameContext.xOffset, this.rect.y, this.rect.width, this.rect.height);
|
|
546
|
+
}
|
|
547
|
+
update(u) {
|
|
548
|
+
this.isDead || this.leftRightMovement(u);
|
|
549
|
+
}
|
|
550
|
+
}, stacheSeed1_default = "data:image/webp;base64,UklGRkwHAABXRUJQVlA4WAoAAAAQAAAAOwAAdwAAQUxQSKMBAAABkGPbkiMpP6JmBmw2xtZYAZ7aBha42tJaa0311DeqOjLiB9KLiAng3lNQPslRl+K4EjN13qdQhp2YrfEgjQq3WCjAykdlz0tYdYfFRSwvYf39go8CzLtDyTSKJlH1XQp1M6jci0MUH2An6vdigC33sOkGf0cEwMaH/P970Mo7uXUCelkfA9AH7dAF2z3wS0AHRPUQV8OoFsaVkKmDXBWkK6DSqlBeAUnLMQjbEpoc8uYbRweOlhsTmm7Yb2qhmQHclDvemTEs9unN+xipxPnrt3mASpmvNSyLNdy2vKsFDxhdkh7k3WJ0ZvLTtMtUvJt18b3ElaxLlETy6WsSt7POvMlYliFkn/0ytjx4+OjJqyWE9HPvx368BPj507wPlR8SCADci9rHYz83VHsh9HMhd1oI7L5/ISkG7AG4NAhy/Y/G1moGMwMYlTLmShyzUKC2xsrYaY6Z+7Tp7gbAqxgxY9jdhZyJLvODPVdf2BQAfrApDACL3ZMAB/C2zMwAhBBlGUrLrMZaoQrVvdALQAp0AMSwlkr8bVmrqZW1Omw1rd6VAABWUDggggUAAFAdAJ0BKjwAeAA+kTyZSaWjIiErEuzwsBIJbAYoBAgPwA/YD/AZ4BAgH4ATnEGj55ndE3Up8hvOhwoWO3V8y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a9nPUufg0K2ik5SyjjDc7NdB0t1E887y69yuGKeparfN8v/9iPzWqRqoN5uzhzo8RZQhxppAEXXGBACYoasIAIFAFOPHyMNrdVKW7O94o+b02yc0qTr8REuHz5pj0iQRdQqGLs1dvWQZu4yZG93xXdp07m5ScRpof/Na9m/W//1Vz0FSFe15vqBFjA/cbPTRJ8/dRO984aUlqKDKVJijezBmhFpEOlAD7MhdQU6bjXEHOvM+yDt/RIcAfId/C7nK/0b3D77DfKrJiYkCz0x8mteNn1ytArPD33o3yEiS2vY+4LG+HfWeZYva1W/Y3fMQ24v/BFuctoNMvtg3rZDqdRk+90BccCka1dfR6WqF2FV9+Qjulie5Lwhdb8sGfCK23Ihgkc2H/1pVmpjf7+F1DKJPph5TQMjFtN4YUnLXK2/2OFDAIOcxjfESZ/j0JUgGiukcxSsxZ5TIVGRFRhFvAO19CnVGNqkljhDlLnVSLW92S/3xsYjIsJggLe1OCMIWWJTFWT0a2gLUoPHI0x9I/Ug0EgmNANNbEAj5xhBHXr0uPtivmMI0VcHQVU0x2HpyjHDOxEpB5wH/IjWAPF8DE3Cl4iUo+0j52857OwjUKR1FkoRLHCnJCufJqCE2YTNJd2W8rKYiHAHDjKtVdShN2gG03WhCFqjN7afC8W5QB9B81l7Rd9TyT/xzz2ytLg1aZ0KlEbz3DIkRMdc/nv3mE2WG4Tf2gFyACAw1JPO5cB/5KliA22KV3l+JKrlCp//IqprJeJunu4DFgRlVYkNotUR0uV64/+OlzDs8WLS8lnMpaRlpqRERuAMZbNaf6kfbtNGvKYABCFOGH5iwf76Qc88fVj/y7H//YLu7m9LaQqss1Md75QBi/MQgAAAAAAA==", StacheSeed = class extends Enemy {
|
|
551
|
+
pointValue = 100;
|
|
552
|
+
inPipe = !1;
|
|
553
|
+
direction;
|
|
554
|
+
parent;
|
|
555
|
+
waitTime = 2500;
|
|
556
|
+
reversed;
|
|
557
|
+
constructor(z, B, V) {
|
|
558
|
+
let H, U;
|
|
559
|
+
V ? (H = B.rect.x + B.rect.width / 2 - 60 / 2, U = B.rect.y + B.rect.height - 180) : (H = B.rect.x + B.rect.width / 2 - 60 / 2, U = B.rect.y), super(z, {
|
|
560
|
+
x: H,
|
|
561
|
+
y: U,
|
|
562
|
+
width: 60,
|
|
563
|
+
height: 180
|
|
564
|
+
}), this.reversed = V, this.parent = B, this.speedY = 1.5, V ? (this.direction = direction.DOWN, this.imageSources.push(stacheSeedReversed1_default, stacheSeedReversed2_default)) : (this.direction = direction.UP, this.imageSources.push(stacheSeed1_default, stacheSeed2_default));
|
|
565
|
+
}
|
|
566
|
+
update(z) {
|
|
567
|
+
this.direction === direction.UP ? (this.rect.y -= this.speedY, this.shouldChangeDirection() && (this.direction = direction.NONE, this.reversed && (this.inPipe = !0), setTimeout(() => {
|
|
568
|
+
this.inPipe = !1, this.direction = direction.DOWN;
|
|
569
|
+
}, this.waitTime))) : this.direction === direction.DOWN && (this.rect.y += this.speedY, this.shouldChangeDirection() && (this.direction = direction.NONE, this.reversed || (this.inPipe = !0), setTimeout(() => {
|
|
570
|
+
this.inPipe = !1, this.direction = direction.UP;
|
|
571
|
+
}, this.waitTime))), this.rect.y < 0 && (this.isDead = !0);
|
|
572
|
+
}
|
|
573
|
+
draw(u) {
|
|
574
|
+
u.drawImage(this.image, this.rect.x + this.gameContext.xOffset, this.rect.y, this.rect.width, this.rect.height);
|
|
575
|
+
}
|
|
576
|
+
shouldChangeDirection() {
|
|
577
|
+
if (this.reversed) {
|
|
578
|
+
if (this.direction === direction.UP) return this.rect.y + this.rect.height < this.parent.rect.y + this.parent.rect.height;
|
|
579
|
+
if (this.direction === direction.DOWN) return this.rect.y > this.parent.rect.y + this.parent.rect.height;
|
|
580
|
+
} else {
|
|
581
|
+
if (this.direction === direction.UP) return this.rect.y + this.rect.height < this.parent.rect.y;
|
|
582
|
+
if (this.direction === direction.DOWN) return this.rect.y > this.parent.rect.y;
|
|
583
|
+
}
|
|
584
|
+
return !1;
|
|
585
|
+
}
|
|
586
|
+
}, Pipe = class extends Obstacle {
|
|
587
|
+
constructor(u, { x: z, y: B, width: V, height: H, hasStacheSeed: U, reversed: W }) {
|
|
588
|
+
super(u, {
|
|
589
|
+
x: z,
|
|
590
|
+
y: B,
|
|
591
|
+
width: V ?? 120,
|
|
592
|
+
height: H ?? 120
|
|
593
|
+
}), U && u.addGameObject(new StacheSeed(u, this, W ?? !1));
|
|
594
|
+
}
|
|
595
|
+
draw(u) {
|
|
596
|
+
u.fillStyle = "green", u.fillRect(this.rect.x + this.gameContext.xOffset, this.rect.y, this.rect.width, this.rect.height);
|
|
597
|
+
}
|
|
598
|
+
}, WarpPipe = class extends Pipe {
|
|
599
|
+
objectId = 0;
|
|
600
|
+
setNewLevel;
|
|
601
|
+
constructor(u, z) {
|
|
602
|
+
super(u, { ...z }), this.setNewLevel = z.setNewLevel;
|
|
603
|
+
}
|
|
604
|
+
enter() {
|
|
605
|
+
this.setNewLevel(this.gameContext);
|
|
606
|
+
}
|
|
607
|
+
}, CaveWall = class extends Block {
|
|
608
|
+
constructor(u, z) {
|
|
609
|
+
super(u, z.x, z.y), this.rect.width = z.width, this.rect.height = z.height;
|
|
610
|
+
}
|
|
611
|
+
draw(u) {
|
|
612
|
+
u.fillStyle = "DarkSlateGray", u.fillRect(this.rect.x + this.gameContext.xOffset, this.rect.y, this.rect.width, this.rect.height);
|
|
613
|
+
}
|
|
614
|
+
};
|
|
615
|
+
function caveOne(u, z = []) {
|
|
616
|
+
u.clearLevel(), u.setStatic(!0), u.addGameObject(new CaveWall(u, {
|
|
617
|
+
x: 0,
|
|
618
|
+
y: 0,
|
|
619
|
+
width: 240,
|
|
620
|
+
height: u.gameArea.height
|
|
621
|
+
})), u.addGameObject(new CaveWall(u, {
|
|
622
|
+
x: 1680,
|
|
623
|
+
y: 0,
|
|
624
|
+
width: 240,
|
|
625
|
+
height: u.gameArea.height
|
|
626
|
+
})), u.addGameObject(new CaveWall(u, {
|
|
627
|
+
x: 240,
|
|
628
|
+
y: 960,
|
|
629
|
+
width: 1440,
|
|
630
|
+
height: 120
|
|
631
|
+
})), u.addGameObject(new CaveWall(u, {
|
|
632
|
+
x: 240,
|
|
633
|
+
y: 0,
|
|
634
|
+
width: 1440,
|
|
635
|
+
height: 120
|
|
636
|
+
})), u.addGameObject(new Pipe(u, {
|
|
637
|
+
x: 240,
|
|
638
|
+
y: 120
|
|
639
|
+
})), u.addGameObject(new WarpPipe(u, {
|
|
640
|
+
x: 1560,
|
|
641
|
+
y: 840,
|
|
642
|
+
setNewLevel: (u) => levelOne(u, [...z, "cave-one"])
|
|
643
|
+
}));
|
|
644
|
+
for (let z = 7; z < 24; z += 2) for (let B = 10; B < 16; B += 2) u.addGameObject(new Coin(u, 60 * z, 60 * B));
|
|
645
|
+
u.addGameObject(new ItemBlock(u, 1620, 540, !0, "fire-stache")), u.setPlayerLocation(60 * 4.5, 300), u.startMainLoop();
|
|
646
|
+
}
|
|
647
|
+
var stacheShotLeft_default = "data:image/webp;base64,UklGRtgBAABXRUJQVlA4IMwBAAAwCgCdASo8ADwAPpFAm0ilpCKhLhbY4LASCUAPEIK9AZttj/CuyZV73NvdCSXROnHj/EkxQqfQuqqsLa4uNiINx+77Rf9yQBeF4QcDPJy+ucV4/8PjBIG2BQAA/v0gsh55KUziS2o6cGbNKP5nqoj+U8aoWlxg+HXikx96lzDMw/Mn8N/5hEl+kz9OU7XtlJ06Z/3f7LC5NPsVVXZvgp8HhtPkCbf5lP6bQgPv7DoI7WFHTGVqYnXum58rdtYE4jeVAqyryrw07pkffG/H1DMO8+iYXd82PGeB3HBuUzZvnpwXq+kr2sKz8D42QSQBDnEts0VfIrFmHVy0eAIG93YoHgV6kHGmsgY53o+h/y/XTJLt96o5U/iS0FN02TcZivjxEETIuh81wcg1YeewCs9u9GhWe89/MEXIUym9YsEmIAIVvy2PY+WMtZpoh/hXRstuMbAqAiYO3nuZOpYavQkeQd966oLsTZWYV7lXZlymlrP7LTKzNReXXuPGHvhT+nxccCsq06I/bdShQrRqwo08fg5Y0uynDKVoy0rcABftxy93W8hOJTDYRd+sM8mZ/1TXsYLOQBBxZEaTsK0uA5a3sMN4IeMaL5QIwAAA", stacheShotRight_default = "data:image/webp;base64,UklGRgACAABXRUJQVlA4IPQBAAAQDQCdASo8ADwAPpE8l0glo6IhLhbccLASCWIA0jGhOz8gSwNZeLjCR23vPD6bpQAHYZXeb4O0BBAax+vnqaC+xF9lzsOt7LcRWkDb3/8+78SdY3MgzwZtqoZzXm39BliOGvNbgrwLT+X4vrEzZgheAAD+/K0TSn6gm3u1s+dnaftFRW4MVDF4F1Mvl2Tt2iUEPqFrOW8yrwVb3Lk78Kgees8+NqtenBs5LtfS8T6kG1/flsNDMdL3EER6NK8eQy5dr1dZN1H6g1AcSakas5XdCchOOkUPHOQGiHaviAS1910rfUAUlBwl2cSAxmtMMws7zQX+wZEfr1ihfjSxaz+iaBtmHlUHBz50zVz4Jt5ar4Llzt0S6rnG0gDGPjjdevW30nOJ0jEwRLFIKS5KaSVn+qd/OpQYAYXhZdfH9qHlxX6j6a1XD/68whQGoN/vEdLWOprYauygQl5oNSr70JBIKpLMeOuCjr/6Ua44xe3Yzz9IK2QXlOtVs/+0pKlU+3UnD46IaqZijgHewYnyeORzCpntDDXfEhG+8yIUPbApMA1q6yS1MW6J09bU2zU+sfm2oAhG0ZZS+ZAMKKCXrjrFKJi5TCo8TNZkjb3+a+II0FHA5Jc+HCDHoSlr8TZrFceiR4PlNYwvb8F27jQWOvhbgAAAAA==", stacheShotUp_default = "data:image/webp;base64,UklGRt4BAABXRUJQVlA4INIBAADwCgCdASo8ADwAPpFAm0ilpCKhLhbY4LASCUAaLnxZDi1+2YP63urTJlbzcCmH6TR4PWr3LWQqWbSBpwns6rhgOrlVxq0mOnocWUymToPtyFy3YsXBb752loJNi8Ns3wAA/v0gAuDKYkvPrQ/MgPnx/iZpJ+CIUDoo6ansnWaN+y2Fza+XQCJuyVNyWfvy8jllLrURIJ91KOhr6espslqj7la1OFsNp39ivnMzNUGPq+SH/Q6ZWys/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4IHd+NqiRRPmKoAAAAA=", StacheShot = class extends Enemy {
|
|
648
|
+
pointValue = 250;
|
|
649
|
+
shotSpeed = 3;
|
|
650
|
+
constructor(z, B, V) {
|
|
651
|
+
let H = B.rect.x + B.rect.width / 2 - 45 / 2, U = B.rect.y + B.rect.height / 2 - 45 / 2;
|
|
652
|
+
if (super(z, {
|
|
653
|
+
x: H,
|
|
654
|
+
y: U,
|
|
655
|
+
width: 45,
|
|
656
|
+
height: 45
|
|
657
|
+
}, !1), V === direction.LEFT) this.image.src = stacheShotLeft_default, this.speedX = -this.shotSpeed;
|
|
658
|
+
else if (V === direction.RIGHT) this.image.src = stacheShotRight_default, this.speedX = this.shotSpeed;
|
|
659
|
+
else if (V === direction.UP) this.image.src = stacheShotUp_default, this.speedY = -this.shotSpeed;
|
|
660
|
+
else if (V === direction.DOWN) this.image.src = stacheShotDown_default, this.speedY = this.shotSpeed;
|
|
661
|
+
else throw Error("Invalid direction for StacheShot");
|
|
662
|
+
}
|
|
663
|
+
update(u) {
|
|
664
|
+
this.rect.x += this.speedX, this.rect.y += this.speedY, outOfBounds(this, this.gameContext) && this.gameContext.removeGameObject(this);
|
|
665
|
+
}
|
|
666
|
+
draw(u) {
|
|
667
|
+
u.drawImage(this.image, this.rect.x + this.gameContext.xOffset, this.rect.y, this.rect.width, this.rect.height);
|
|
668
|
+
}
|
|
669
|
+
}, cannonUp_default = "data:image/webp;base64,UklGRkYAAABXRUJQVlA4IDoAAADwAwCdASo8ADwAPpFEnUolo6KhqAgAsBIJaQAALmhwcME6CL5IYicAAP78RMj/BTmnD13EcYAAAAAA", cannonDown_default = "data:image/webp;base64,UklGRkIAAABXRUJQVlA4IDYAAADwAwCdASo8ADwAPpFCnUqlo6KhqAgAsBIJaQABQcWhyItjPA5fdZK0AP4AARXuQ/sI5wwAAAA=", cannonLeft_default = "data:image/webp;base64,UklGRkQAAABXRUJQVlA4IDgAAADwAwCdASo8ADwAPpFEnUolo6KhqAgAsBIJaQAAIaVW1NrFmSRRs4iAAP78SA/78D+QD4AyIAAAAA==", cannonRight_default = "data:image/webp;base64,UklGRkIAAABXRUJQVlA4IDYAAADwAwCdASo8ADwAPpFCnUqlo6KhqAgAsBIJaQABQboF2GL8nGHi57NMAP4Cv9b+k3fxwAAAAAA=", StacheCannon = class extends Block {
|
|
670
|
+
image = new Image();
|
|
671
|
+
shotTimer;
|
|
672
|
+
constructor(z, B, V, H) {
|
|
673
|
+
if (super(z, B, V), H === direction.UP) this.image.src = cannonUp_default;
|
|
674
|
+
else if (H === direction.DOWN) this.image.src = cannonDown_default;
|
|
675
|
+
else if (H === direction.LEFT) this.image.src = cannonLeft_default;
|
|
676
|
+
else if (H === direction.RIGHT) this.image.src = cannonRight_default;
|
|
677
|
+
else throw Error("Invalid direction for StacheCannon");
|
|
678
|
+
this.shotTimer = setInterval(() => {
|
|
679
|
+
outOfBounds(this, this.gameContext) || this.gameContext.addGameObject(new StacheShot(this.gameContext, this, H), !0);
|
|
680
|
+
}, 6e3);
|
|
681
|
+
}
|
|
682
|
+
draw(u) {
|
|
683
|
+
u.drawImage(this.image, this.rect.x + this.gameContext.xOffset, this.rect.y, this.rect.width, this.rect.height);
|
|
684
|
+
}
|
|
685
|
+
dispose() {
|
|
686
|
+
clearInterval(this.shotTimer);
|
|
687
|
+
}
|
|
688
|
+
}, EnemyProjectile = class extends Projectile {}, FireCross = class extends EnemyProjectile {
|
|
689
|
+
direction;
|
|
690
|
+
maxLength = 240;
|
|
691
|
+
minLength = 60 * .5;
|
|
692
|
+
constructor(u, z, B) {
|
|
693
|
+
let V = z.rect.x + z.rect.width / 2 - 15, H = z.rect.y + z.rect.height / 2 - 15;
|
|
694
|
+
super(u, {
|
|
695
|
+
x: V,
|
|
696
|
+
y: H,
|
|
697
|
+
width: 30,
|
|
698
|
+
height: 30
|
|
699
|
+
}), this.speedY = .75, this.speedX = .75, this.direction = B;
|
|
700
|
+
}
|
|
701
|
+
update(z) {
|
|
702
|
+
this.direction === direction.LEFT ? (this.rect.x -= this.speedX, this.rect.width += this.speedX) : this.direction === direction.RIGHT ? this.rect.width += this.speedX : this.direction === direction.UP ? (this.rect.y -= this.speedY, this.rect.height += this.speedY) : this.direction === direction.DOWN && (this.rect.height += this.speedY), this.rect.width > this.maxLength || this.rect.height > this.maxLength ? (this.speedX = -Math.abs(this.speedX), this.speedY = -Math.abs(this.speedY)) : (this.rect.width < this.minLength || this.rect.height < this.minLength) && (this.speedX = Math.abs(this.speedX), this.speedY = Math.abs(this.speedY));
|
|
703
|
+
}
|
|
704
|
+
draw(u) {
|
|
705
|
+
u.fillStyle = "red", u.fillRect(this.rect.x + this.gameContext.xOffset, this.rect.y, this.rect.width, this.rect.height);
|
|
706
|
+
}
|
|
707
|
+
}, FireCrossBlock = class extends Block {
|
|
708
|
+
image = new Image();
|
|
709
|
+
constructor(u, z, B, V) {
|
|
710
|
+
super(u, z, B), this.image.src = obstacleBrick_default;
|
|
711
|
+
for (let z of V) this.gameContext.addGameObject(new FireCross(u, this, z));
|
|
712
|
+
}
|
|
713
|
+
draw(u) {
|
|
714
|
+
u.drawImage(this.image, this.rect.x + this.gameContext.xOffset, this.rect.y, this.rect.width, this.rect.height);
|
|
715
|
+
}
|
|
716
|
+
}, FireBar = class extends RotatingGameObject {
|
|
717
|
+
anchorBlock;
|
|
718
|
+
constructor(u, z, B, V) {
|
|
719
|
+
super(u, {
|
|
720
|
+
x: z,
|
|
721
|
+
y: B,
|
|
722
|
+
width: 10,
|
|
723
|
+
height: 250
|
|
724
|
+
}), this.anchorBlock = V;
|
|
725
|
+
}
|
|
726
|
+
update(u) {
|
|
727
|
+
this.rotation += this.rotationSpeed, this.rotation %= Math.PI * 2;
|
|
728
|
+
let z = this.anchorBlock.rect.x + this.anchorBlock.rect.width / 2, B = this.anchorBlock.rect.y + this.anchorBlock.rect.height / 2;
|
|
729
|
+
this.rect.x = z - this.rect.width / 2, this.rect.y = B - this.rect.height;
|
|
730
|
+
}
|
|
731
|
+
draw(u) {
|
|
732
|
+
u.save(), u.translate(this.rect.x + this.rect.width / 2 + this.gameContext.xOffset, this.rect.y + this.rect.height), u.rotate(this.rotation), u.fillStyle = "red", u.fillRect(-this.rect.width / 2, -this.rect.height, this.rect.width, this.rect.height), u.restore();
|
|
733
|
+
}
|
|
734
|
+
}, FireBarBlock = class extends Block {
|
|
735
|
+
image = new Image();
|
|
736
|
+
constructor(u, z, B) {
|
|
737
|
+
super(u, z, B), this.image.src = obstacleBrick_default;
|
|
738
|
+
let V = new FireBar(u, this.rect.x + this.rect.width / 2 - 5, this.rect.y + this.rect.height / 2 - 50, this);
|
|
739
|
+
this.gameContext.addGameObject(V);
|
|
740
|
+
}
|
|
741
|
+
draw(u) {
|
|
742
|
+
u.drawImage(this.image, this.rect.x + this.gameContext.xOffset, this.rect.y, this.rect.width, this.rect.height);
|
|
743
|
+
}
|
|
744
|
+
}, Laser = class extends EnemyProjectile {
|
|
745
|
+
constructor(u, z, B) {
|
|
746
|
+
let V = u.gameArea.height, H = z.rect.x + z.rect.width / 2 - 30 / 2, U = z.rect.y + z.rect.height;
|
|
747
|
+
super(u, {
|
|
748
|
+
x: H,
|
|
749
|
+
y: U,
|
|
750
|
+
width: 30,
|
|
751
|
+
height: V
|
|
752
|
+
}), setTimeout(() => {
|
|
753
|
+
this.gameContext.removeGameObject(this);
|
|
754
|
+
}, B);
|
|
755
|
+
}
|
|
756
|
+
update(u) {}
|
|
757
|
+
draw(u) {
|
|
758
|
+
u.fillStyle = "blue", u.fillRect(this.rect.x + this.gameContext.xOffset, this.rect.y, this.rect.width, this.rect.height), u.strokeStyle = "black", u.lineWidth = 2, u.strokeRect(this.rect.x, this.rect.y, this.rect.width, this.rect.height);
|
|
759
|
+
}
|
|
760
|
+
}, stacheStreaker1_default = "data:image/webp;base64,UklGRpoDAABXRUJQVlA4II4DAAAwFwCdASqEADwAPo06mUelI6KhMdTbAKARiWoAy5y+hd/Icrv0RD3e38SXqDeYf9Y/2798P0j+gf/luoQ3k/9uvSqisbnrsXlrh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ocrkZ3V2WFPc14E9hWPqLnKkS+SzQY75/QOs8s0wObjgAAAA", stacheStreaker2_default = "data:image/webp;base64,UklGRswDAABXRUJQVlA4IMADAACwFwCdASqEADwAPo06l0elI6IhNHTqcKARiWoAzQnvfqvUff0RT1PfKcGjbzxGuot5h/1l/cD3pP6r6zPQO/1XUQehB0qn7aeldFVHSPYbLyigkN5lNkWACsnKLAdu/TAdILm1754RtOjmXKdM4XFkLi1jTApc9SMGagprUhRMCJZppLBaZ8m1ovQPnG9VGkqQOSJGKLR7ZptuvjL2+hGGuK9YR3ZB9BI0kb/2nFD4DoikFjBcnJIw37F59k9svJS/eQjZYAAA/uvItBaF6En/6En/6Em4b+VY+UL8e7lIyqMDiREAyCLEJU3+5BYyDv+CW02lIT+oxnWXT70t5M1fpT1SEJfWAKAf7VBiwCzxlPTht/9PAF6D6put6cdxHFw2CVUgcntveycnSu/o/+35VtFHvrOhyOyRyH1kQaAMccQAXeRVOLu6H5CupUhdQmDkcTTrtGOeLIY5j0DthwzDNV8MKHQ7I8aXyqZMCUg1qdUQi+smfyhuiYpN3m9jcKN9jodOtdQRE+Rsp1hUlrklr6dv9DBR9/EbjTNSj1XcIoAy+h3fBXsailxCFYZiPtEreTwkx2ZYZfkTLRy1OP8xt/ZdkdiIyuX/18gXepbni0STM+z40MIs3CVAflNNFkKIff5Nu7aLiT0Kl+JQ0ZIseviAi/cADG5vTSgKXyujIIoiuM28CW4BCrDiTUFqdiYa9PzW3C/gfjC2DC7GmlWn+zHy1NYbIYGgBwc9vgJYoVmcp0fJCAFIZfqJedxorgSOqNpySlsMiJDGyWmnZbaF6t/JB4Da/0BBtUHuAF4b1NJArJkdpzHP/XVMieZ075BC8TT678+TvHgFGAGOWiqZUgZBOtUzxkibwotgXbtHjn3PTu6HF1LNM1keoXz1li+Ak92WEdJ294m7UGPIV5dY3jKGCNLnbAUrkHcadnd9NCw3LydWYetSr8I/0bekbTFuAqD8kS6VLQyoKES238dpDQtELVAi6p8Mc8BlS9bW3c7DyeH7q8ZfTJjbA6QA+nJJzu/RaqqXUs1bCdnc2YnDHlZ7XzvyrT59ry4J/1cvFRQJOOU3VqFhC9iMl9OiHB7etondUCXa2rdj8aIYRHCbvD21omvbL+zp5Tb9qNGko8FFmWOcUSpxqU7OEb1IDMGo5Prwv3v6mQulbg94xvf4pl4OZHqN/Zak0nqeaxMttuw30lsFQhRHKbV5a2tQ0E3Y3ce1td3BRg7zFyLN+WyHrqJBMqUhOY6UX+PJEJDYD+NHdtCjvz+VtJOO928AAAA=", StacheStreaker = class extends Enemy {
|
|
761
|
+
pointValue = 1250;
|
|
762
|
+
canMove = !0;
|
|
763
|
+
totalDistance = 0;
|
|
764
|
+
timeBetweenShots = 3500;
|
|
765
|
+
shotTime = 5e3;
|
|
766
|
+
constructor(u, z, B) {
|
|
767
|
+
super(u, {
|
|
768
|
+
x: z,
|
|
769
|
+
y: B,
|
|
770
|
+
width: 120,
|
|
771
|
+
height: 60 * 1.5
|
|
772
|
+
}, !1), this.imageSources.push(stacheStreaker1_default, stacheStreaker2_default), this.image.src = this.imageSources[0], this.speedX = 1, this.shotTimer = setTimeout(() => {
|
|
773
|
+
this.fireLaser();
|
|
774
|
+
}, this.timeBetweenShots);
|
|
775
|
+
}
|
|
776
|
+
update(u) {
|
|
777
|
+
!this.isDead && this.canMove && (this.rect.x += this.speedX, this.totalDistance += Math.abs(this.speedX), this.totalDistance >= 300 && (this.speedX *= -1, this.totalDistance = 0));
|
|
778
|
+
}
|
|
779
|
+
draw(u) {
|
|
780
|
+
u.drawImage(this.image, this.rect.x + this.gameContext.xOffset, this.rect.y, this.rect.width, this.rect.height);
|
|
781
|
+
}
|
|
782
|
+
fireLaser() {
|
|
783
|
+
this.gameContext.addGameObject(new Laser(this.gameContext, this, this.shotTime)), this.canMove = !1, this.setNextImage(), this.shotTimer = setTimeout(() => {
|
|
784
|
+
this.canMove = !0, this.setNextImage(), this.shotTimer = setTimeout(() => {
|
|
785
|
+
this.fireLaser();
|
|
786
|
+
}, this.timeBetweenShots);
|
|
787
|
+
}, this.shotTime);
|
|
788
|
+
}
|
|
789
|
+
}, homestead_default = "data:image/webp;base64,UklGRhwVAABXRUJQVlA4IBAVAACwaACdASosASwBPpFAm0qlo6MhpjEr6LASCU3cLYwdc7+0dkX1f+i/Mf20eYfDn1fFMeJQD/5n1Mf3j+7/rp8AH6cfqr6337Ae5DzHfzr/Hfur7un/M9Yn+f9QD+6edP7H/9U9RjznfVw/s//lyjvw7/ee0j/a/3Tp1PREuTvfzS/cL+N/fPbT+8f6T8mfNv4P6gX5J/J/9RvzOp/6L0Au7v/I8I7UIyAPzD9JP+Z4Ivz/1BP5r/nPVh/of/V/lfzK9n31X7Bv82/u/prexn9tv//7mP7uhjjTScqDRRlINkdLaOj9S28HSPBtmGqjG6UZySRWm3KZDPQsKJEBVN/dgp8ipxlurL1X/sPePonRvn5utAmgjygyZA3cccWUtJ+/wE/Ni+JoD12Y7vVrFrcJzD8povWzBkoRWqqC/7KelSLwI/dvN1MsswJs3TapoWxbVhDrM2OvWssos44TUMQ7tipDvD1zbHmhlamFTrgnb8cs/l3T5+s5//0aHeqlfXSDFPCel7PcDC3a1Z2l3IypiKB0ej6VXzNdN74B+sWoH2ZfTI/Y1gjU9OJ2f6YDX7oVN8en8jug704xd4PLqTA07XYx9VuzRdqLIqKo2+9PmPeL8rkQbpACS2fgq6GJBrPblJ4Q+2sXwm4AJ4HT/Mlxb4haPUXdb2B1wcDp/JIyrhp8e+9AAanfIxL5yGX5wp0IdBGMb29sh+fntaVGJ1Gqd92u2nRADizk82jjCKoG4ZJgkED/h4WYiil38XezEc2pcQL6pEhYyTajSnP37CvQqn0XgpVcRsnO7aRE/4z+hZfVARTa/3n5zUHa7K/tQYX2KGVjvKkn/GY6ro7gLIKiDI4J31bgYAAD5BC2vn7IAEEuW34kGSxcJ2g81womm0CPO5wlI7sr4ef4ocZkSDFn4//UgRXYAkzBWh/+COQ5Yde1rW6BQyXzy/aqfimNtT4YfQDG0/1GM7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2DfKAD8yoz88AAZf1AAHGY0jbeFrzIEQOm16AA0lgBm9Blkj+avAbK8AAACDfQRpKvSJDzCoAunOa9+tvwmlBQdRIy2kAuz+bnj/0YAUtGYMxeneUAAAAAA==", Flag = class extends SetPiece {
|
|
790
|
+
image = new Image();
|
|
791
|
+
constructor(u, z, B) {
|
|
792
|
+
super(u, {
|
|
793
|
+
x: z,
|
|
794
|
+
y: B,
|
|
795
|
+
width: 480,
|
|
796
|
+
height: 480
|
|
797
|
+
}), this.image.src = homestead_default;
|
|
798
|
+
}
|
|
799
|
+
closeDoor() {
|
|
800
|
+
this.image.src = homesteadClosed_default;
|
|
801
|
+
}
|
|
802
|
+
draw(u) {
|
|
803
|
+
u.drawImage(this.image, this.rect.x + this.gameContext.xOffset, this.rect.y, this.rect.width, this.rect.height);
|
|
804
|
+
}
|
|
805
|
+
};
|
|
806
|
+
function levelOne(u, z = []) {
|
|
807
|
+
u.clearLevel(), sectionOne(u), sectionTwo(u), sectionThree(u, z), sectionFour(u), sectionFive(u), sectionSix(u), sectionSeven(u), z[0] === "cave-one" && u.setPlayerLocation(4140, 480), u.startMainLoop();
|
|
808
|
+
}
|
|
809
|
+
function sectionOne(u) {
|
|
810
|
+
u.addGameObject(new Floor(u, {
|
|
811
|
+
x: 0,
|
|
812
|
+
y: 1020,
|
|
813
|
+
width: 2400,
|
|
814
|
+
height: 60
|
|
815
|
+
})), createBlockWall(u, 0, 0, 1, 17, "wall"), createBlockWall(u, 1, 5, 1, 11, "coin"), u.addGameObject(new ItemBlock(u, 360, 840, !1, "coin")), u.addGameObject(new Brick(u, 420, 840)), u.addGameObject(new ItemBlock(u, 480, 840, !0, "coin")), u.addGameObject(new ItemBlock(u, 480, 660, !0, "coin")), u.addGameObject(new Brick(u, 540, 840)), u.addGameObject(new ItemBlock(u, 600, 840, !1, "coin")), createBlockPyramid(u, 16, 16, 12, "wall"), u.addGameObject(new Wall(u, 2340, 960)), u.addGameObject(new StacheStalker(u, 1680, 840)), u.addGameObject(new StacheStalker(u, 2040, 840));
|
|
816
|
+
}
|
|
817
|
+
function sectionTwo(u) {
|
|
818
|
+
u.addGameObject(new Wall(u, 2760, 960)), u.addGameObject(new ItemBlock(u, 2940, 780, !1, "coin")), u.addGameObject(new ItemBlock(u, 2940, 540, !0, "stacheroom")), createBlockSquare(u, 53, 11, 6, 4, "brick"), createBlockWall(u, 54, 12, 4, 2, "coin"), u.addGameObject(new Pipe(u, {
|
|
819
|
+
x: 3840,
|
|
820
|
+
y: 900,
|
|
821
|
+
hasStacheSeed: !0
|
|
822
|
+
})), u.addGameObject(new Floor(u, {
|
|
823
|
+
x: 2760,
|
|
824
|
+
y: 1020,
|
|
825
|
+
width: 1200,
|
|
826
|
+
height: 60
|
|
827
|
+
}));
|
|
828
|
+
}
|
|
829
|
+
function sectionThree(z, B) {
|
|
830
|
+
createBlockWall(z, 66, 17, 23, 1, "wall");
|
|
831
|
+
let V;
|
|
832
|
+
V = B.includes("cave-one") ? new Pipe(z, {
|
|
833
|
+
x: 4380,
|
|
834
|
+
y: 540
|
|
835
|
+
}) : new WarpPipe(z, {
|
|
836
|
+
x: 4380,
|
|
837
|
+
y: 540,
|
|
838
|
+
setNewLevel: caveOne
|
|
839
|
+
}), createBlockWall(z, 73, 11, 2, 1, "wall"), z.addGameObject(V), createBlockWall(z, 78, 16, 1, 1, "wall"), z.addGameObject(new StacheCannon(z, 4680, 900, direction.LEFT)), createBlockWall(z, 80, 15, 1, 2, "wall"), z.addGameObject(new StacheCannon(z, 4800, 840, direction.LEFT)), createBlockWall(z, 82, 14, 1, 3, "wall"), z.addGameObject(new StacheCannon(z, 4920, 780, direction.LEFT)), createBlockWall(z, 84, 13, 1, 4, "wall"), z.addGameObject(new StacheCannon(z, 5040, 720, direction.LEFT));
|
|
840
|
+
}
|
|
841
|
+
function sectionFour(u) {
|
|
842
|
+
createBlockWall(u, 89, 17, 33, 1, "falling-floor");
|
|
843
|
+
for (let z = 0; z < 11; z++) u.addGameObject(new Pipe(u, {
|
|
844
|
+
x: 60 * (89 + z * 3),
|
|
845
|
+
y: 0,
|
|
846
|
+
height: 840,
|
|
847
|
+
hasStacheSeed: !0,
|
|
848
|
+
reversed: !0
|
|
849
|
+
}));
|
|
850
|
+
createBlockWall(u, 122, 17, 5, 1, "wall");
|
|
851
|
+
}
|
|
852
|
+
function sectionFive(z) {
|
|
853
|
+
createBlockWall(z, 126, 14, 1, 3, "wall"), z.addGameObject(new ItemBlock(z, 7260, 780, !1, "stacheroom")), z.addGameObject(new FireCrossBlock(z, 7560, 780, [direction.LEFT, direction.RIGHT])), z.addGameObject(new FireBarBlock(z, 7560, 420)), createBlockWall(z, 129, 13, 1, 4, "coin"), createBlockWall(z, 129, 17, 1, 1, "wall"), createBlockWall(z, 133, 17, 15, 1, "wall"), createBlockWall(z, 132, 0, 1, 14, "wall"), createBlockWall(z, 137, 5, 1, 12, "wall"), z.addGameObject(new FireCrossBlock(z, 7920, 1020, [direction.UP])), z.addGameObject(new FireCrossBlock(z, 8160, 840, [direction.LEFT])), z.addGameObject(new FireCrossBlock(z, 7980, 660, [direction.RIGHT])), z.addGameObject(new FireCrossBlock(z, 8160, 480, [direction.LEFT])), z.addGameObject(new FireCrossBlock(z, 7980, 300, [direction.RIGHT])), createBlockWall(z, 138, 5, 4, 1, "falling-floor"), createBlockWall(z, 138, 8, 4, 1, "falling-floor"), createBlockWall(z, 138, 11, 4, 1, "falling-floor"), createBlockWall(z, 138, 14, 4, 1, "falling-floor"), createBlockWall(z, 142, 0, 1, 15, "wall"), z.addGameObject(new StacheStalker(z, 8400, 360)), z.addGameObject(new StacheStalker(z, 8400, 540)), z.addGameObject(new StacheStalker(z, 8400, 720));
|
|
854
|
+
}
|
|
855
|
+
function sectionSix(z) {
|
|
856
|
+
for (let B = 0; B < 5; B++) z.addGameObject(new StacheCannon(z, 8580, 60 * (B * 3 + 2), direction.RIGHT));
|
|
857
|
+
createBlockWall(z, 150, 3, 1, 1, "wall"), createBlockWall(z, 150, 6, 1, 1, "wall"), createBlockWall(z, 150, 9, 1, 1, "wall"), createBlockWall(z, 150, 12, 1, 1, "wall"), createBlockWall(z, 150, 15, 1, 1, "wall"), createBlockWall(z, 153, 4, 1, 1, "wall"), createBlockWall(z, 153, 7, 1, 1, "wall"), createBlockWall(z, 153, 10, 1, 1, "wall"), createBlockWall(z, 153, 13, 1, 1, "wall"), createBlockWall(z, 153, 16, 1, 1, "wall"), createBlockWall(z, 156, 2, 1, 1, "wall"), createBlockWall(z, 156, 5, 1, 1, "wall"), createBlockWall(z, 156, 8, 1, 1, "wall"), createBlockWall(z, 156, 11, 1, 1, "wall"), createBlockWall(z, 156, 14, 1, 1, "wall"), createBlockWall(z, 159, 3, 1, 1, "wall"), createBlockWall(z, 159, 6, 1, 1, "wall"), createBlockWall(z, 159, 9, 1, 1, "wall"), createBlockWall(z, 159, 12, 1, 1, "wall"), createBlockWall(z, 159, 15, 1, 1, "wall"), z.addGameObject(new StacheStreaker(z, 9300, 0));
|
|
858
|
+
let B = new StacheStreaker(z, 9120, 0);
|
|
859
|
+
B.speedX *= -1, z.addGameObject(B), z.addGameObject(new Pipe(z, {
|
|
860
|
+
x: 9720,
|
|
861
|
+
y: 0,
|
|
862
|
+
height: 240,
|
|
863
|
+
hasStacheSeed: !0,
|
|
864
|
+
reversed: !0
|
|
865
|
+
})), z.addGameObject(new Pipe(z, {
|
|
866
|
+
x: 9720,
|
|
867
|
+
y: 600,
|
|
868
|
+
height: 480,
|
|
869
|
+
hasStacheSeed: !0
|
|
870
|
+
}));
|
|
871
|
+
}
|
|
872
|
+
function sectionSeven(u) {
|
|
873
|
+
createBlockWall(u, 168, 7, 2, 1, "falling-floor"), createBlockWall(u, 172, 4, 2, 1, "falling-floor"), createBlockWall(u, 184, 15, 2, 1, "falling-floor"), createBlockWall(u, 189, 12, 1, 1, "falling-floor"), createBlockWall(u, 193, 9, 1, 1, "falling-floor"), createBlockWall(u, 189, 6, 1, 1, "falling-floor"), createBlockWall(u, 193, 3, 1, 1, "falling-floor"), createBlockWall(u, 194, 2, 1, 15, "falling-floor"), createBlockSquare(u, 198, 7, 10, 6, "falling-floor"), createBlockWall(u, 199, 8, 8, 4, "coin"), createBlockWall(u, 208, 17, 32, 1, "wall"), u.addGameObject(new Flag(u, 13200, 540), !0);
|
|
874
|
+
}
|
|
875
|
+
var Background = class extends GameObject {
|
|
876
|
+
constructor(u) {
|
|
877
|
+
super(u, {
|
|
878
|
+
width: u.gameArea.width,
|
|
879
|
+
height: u.gameArea.height,
|
|
880
|
+
x: 0,
|
|
881
|
+
y: 0
|
|
882
|
+
});
|
|
883
|
+
}
|
|
884
|
+
draw(u) {
|
|
885
|
+
u.fillStyle = "#87CEEB", u.fillRect(0, 0, this.rect.width, this.rect.height);
|
|
886
|
+
}
|
|
887
|
+
}, Cloud = class extends UpdatingGameObject {
|
|
888
|
+
speed = .3;
|
|
889
|
+
constructor(u, z, B) {
|
|
890
|
+
super(u, {
|
|
891
|
+
width: 100,
|
|
892
|
+
height: 60,
|
|
893
|
+
x: z,
|
|
894
|
+
y: B
|
|
895
|
+
});
|
|
896
|
+
}
|
|
897
|
+
update(u) {
|
|
898
|
+
this.rect.x -= this.speed, this.rect.x + this.rect.width < 0 && (this.rect.x = this.gameContext.gameArea.width);
|
|
899
|
+
}
|
|
900
|
+
draw(u) {
|
|
901
|
+
u.fillStyle = "#FFFFFF", u.beginPath(), u.arc(this.rect.x, this.rect.y - 20, 25, 0, 360), u.arc(this.rect.x + 20, this.rect.y, 25, 0, 360), u.arc(this.rect.x - 20, this.rect.y, 25, 0, 360), u.closePath(), u.fill();
|
|
902
|
+
}
|
|
903
|
+
}, StacheBall = class extends Projectile {
|
|
904
|
+
constructor(u, z, B) {
|
|
905
|
+
super(u, {
|
|
906
|
+
x: z,
|
|
907
|
+
y: B,
|
|
908
|
+
width: 8,
|
|
909
|
+
height: 8
|
|
910
|
+
});
|
|
911
|
+
}
|
|
912
|
+
update(u) {
|
|
913
|
+
if (this.leftRightMovement(u), this.onGround && (this.speedY = -5.5), this.rect.x < 0 || this.rect.x > this.gameContext.gameArea.width) {
|
|
914
|
+
this.gameContext.removeGameObject(this);
|
|
915
|
+
return;
|
|
916
|
+
}
|
|
917
|
+
for (let z of u) if (z.gameObject instanceof Enemy) {
|
|
918
|
+
z.gameObject.enemyHit(), this.gameContext.removeGameObject(this);
|
|
919
|
+
return;
|
|
920
|
+
}
|
|
921
|
+
}
|
|
922
|
+
draw(u) {
|
|
923
|
+
u.beginPath(), u.lineWidth = 5, u.fillStyle = "red", u.arc(this.rect.x + this.gameContext.xOffset, this.rect.y, this.rect.height, 0, 2 * Math.PI), u.fill();
|
|
924
|
+
}
|
|
925
|
+
}, Mustachio_default = "data:image/webp;base64,UklGRgYCAABXRUJQVlA4IPoBAABQCwCdASomACYAPo04lUelIyIhNVgIAKARiWwAyNFBWX5jTvC24w1gf1J8rBuRWmV7yd5QCeBDI/Fk9c9CANn/nj92uRiLabqfj1eiHPUT8fSIUWEaMdjfBdV/L1+t03zxRwAA4m05COfzc3hzuHKXjsHFjb9lwzYLAnbQoJeOK9u1G6ed7MpP6MjO7O/bqo0PL4QPdZLY8XFwIAaX5jCmWN9JnNinKo+dds0jTi9avcf/DZ4PHw2MFZLs/Z416VUppaFgxYEPCpPfAtPUL2ggDLqZ8LNGyA/M/XphyZgsyPuwTYP/2K3Rxm3r5dTOyVfMALTkly5CowVJpEqCDpqrLX6hd5iPqvPsNe8/JHdac6lNeO/mUezbleL0EFaCqDkM5tH3wuka/MHB0P3UDg8FgTCWfyuJ3/ge/T0Mwg5pPxKZgfwlNZuHNsw34oY3CNDeQm9D/ftWLLUzC7MRZ/cBP8SP75mz4/rnzyFjxMPKBf1H5jVNUA6P+lDqBPxbnirKsuDtqvhuXuapg0ZXxbrqhqFyjsXMOVa5WhUVosFeuy3KHy/HiqV7LYNc+V3Kff4eUuWzvYbcjMsQJCmyBpBB00OfMQBsN81AC3Vs7B4rKFjqbURTPiSfql4pr2slrXsC/9BcPWQEj0N5f6U5x12u0AJJgTgKAfzAAA==", Mustachio_FacingLeft_default = "data:image/webp;base64,UklGRmgBAABXRUJQVlA4IFwBAACQBwCdASomACYAPpE8mEgloyIhLjgLMLASCWYAvNeJvWEKpsLR0KKk/yY7oXq/Oo7f0lK/CO4Xz6ree4q1LhHVGfZdbAAA/oigVXqu7tpPNZEBnAv9UjL8c2bfJKz7o/MOk6pfnN56OQ2tOLaJKwjeLhcpzOrCa4018Ze/KtO/Pq/DGicpZpWlyXv+VgTD+lDQvd58ARrft1Qd8qddA14N3WkxL+xiItjw+grV/nDa9qy5tRrdwAbIg6bELMD+5GQGakU7uVJpHxLp3hsnmr07mhFnzUrP4jjM3CrNtaLiH9fHyC8rqNdvQkAejTtkNr0aplmoC4dID3w5F28+Tcvk9JC27aQmhmHP2LUML9d9dJkXnlOrBo/zqN3XjNWzN9mbY+Yw00w5D/KUrSxMTdXbqz+m+OC40r/zX9q1GOFFhCX6+M94XB1DhDd5fiL0F/pZVGzieGIGzXNqYAA=", Mustachio_FacingRight_default = "data:image/webp;base64,UklGRp4BAABXRUJQVlA4IJIBAADwCACdASonACYAPpE+l0elo6IhLjv7MLASCWgAtRu+Boe7xKLbnzS4V7PtKegHK+aFFyeRM9uC4kzq9NiLsFfdvdZSrCdsjtv7wZ3zETHK+ADie9zo8swTYs68ZgH8bRvTh7/9T+3/Jx/ycf15OCaDY8lyp3+ErvygqyOjrYgfMw7b1wKTf2X1S65kNCiwUIImnmODteG2I5/SWBWPKoDrRN972PQuGM9ANekiNIy4FVnaDthag/BohtRYlMeA1poRM1KjbRm789Xzrw5b/g24jvoqJDuG/QP52n4vMQ9pHm4igjO3PPbytXwVE0t4b6zee7BatH55XsEJVW8nIIK1b6oSvWiPYFa+FYAtcfGXEsy1W7o8jsYCYmOHYrUC2HVSG+Rz0glpb5m480m48KNxgzCZKso1OYn59m/vfvfk3QkZf5hqRcHKerPP0pQwqzXg9mTf5kMbN1Dx7HLsOkffs4hnUArWhaemM2uSOIw/uUkrT9+8ZBf4JsCnbJeyQZKoUj2UAg1OP9gZmQdDcH/IAAA=", Mustachio_Fire_default = "data:image/webp;base64,UklGRgwCAABXRUJQVlA4IAACAABwDQCdASomACYAPo06mEelI6KhNVVYAKARiWwAuzPVxMeq8a+9/Vj9QG2o8wH67fqr70nOzdYBz4/sd+UrdzWUAuwWQKZZ4oHpP7M+xWGdcpPIAblvxCiwZDdwxqUHGyWB18DjD+CDCda89PdPFwo/UrUawAD+ywn6EouP7wirCliIrD5Ca+IvUwzhX/FJUde7qiL1QwS1xsnd12LzfXyq2iDcwNRBncZ//NE1pbM35uriq/5bVyb/Tp/z+rTUfKB/76CgYgk232prNu1nwe97Tdv5R0g94G/9XijgkEQ1pivAxtbAJOHTBzDTLe056717VXC6H+X2v+oor9W8IdbrIesGMXbR1H38/Yj3j4iCSVd7zXpiD3GZxh4V369SjmwqXqfuh+50QUArCJQYP3t6X31Lq9BQJ8rR5Z1fj8EHIO6/d4rdRpG6TzL/WQ9NsT7Ot/Pg5AxaSG0888P80aDj5f+L7vbOyw53tuaZQI2nKKKrmC9VztgAfhspNFuqZql4fkW4BiXKp1G3oBOGQvzXrG5PeVldkHqoZKLoetnsf535eGAq1aVIEKPsUprzwHlQD/kbE//ZybWErOl068RE6AHmwzn35P1BFxLJIC6oxOVTwuwFHYuKllMaiBLDftNUY1V8ffF+2Q1wDeGTF4B8/LWWTonsCEn39dMcAAAAAA==", Mustachio_FacingLeft_Fire_default = "data:image/webp;base64,UklGRlgBAABXRUJQVlA4IEwBAABQBgCdASomACYAPpFAmkklo6KhLjgIALASCWYAeQFIA9DgrwPZUOjk+FQygu+to6a/Z+gX9iYtJAPNAAD+QS+RHGVYx7oG5eNiQWE89nPXLwIwIj7eORIl5vw18wlF58Z/Et83ZD+uQjsFPmWywQQn//BL5nVTk95bf1C4pT/25az+vxKKDho+zWfhLxHZ76P4IjHTqQoVLL//EtWn399Rmnz6rxXUAbrSAf8pO0ysJ5xZT34PDGBoWxbVjsQhKknmap8vSdzutlyYPPZZ8faT7B9yqVw1bX+lxfzDo/+AYezLPuMvj4JN6U2Vbxy2l8hU0Nui14g17+Kfvv3FcwkWLr8zKBTMf5rTd3j3RpNkPXeFkGRSv+7VICjCvtcvktTACC+xDGMduqVN/l8qr3MoS+nZNGeWIV825/9f9sjhSZLNQPIvGmcPyUAAAA==", Mustachio_FacingRight_Fire_default = "data:image/webp;base64,UklGRogBAABXRUJQVlA4IHwBAADwCACdASomACYAPo0+mUelI6KhLjv7MKARiWoAeDf2D8gOWoS76gNtX4uXrVWR/+25aAmTTj8mT45eEE6U+Vnfwgej3KPw9ermt6IgFrVcAAD+7v+f/+80L6kFf//voB3oB3oB++n3tcRwrNmYzQwKmKDCDEwCc78Hl3GZ+gyqZ4T0QGKHAbjc+tGaK62+UPJ6P0sEewEAQ9h+fYLtHyXkhIj4OOzakLSxqXiM+frNbAv0YiKlLJNurNZNcXs2xj8q8/9f7hEkXse78R3lX4WzPkc1B+PYcBM6vyX4C8GBGQq+s1//H3y16lgJx29Mf4RNyeSgED52V+bOEwQA7UJn37D/uSf3G0x3hFftsDbkrmSGIJqN4NnNCQBqEwgC+wSD3ye5OOuf3jO4lDMunDo9xXkkVnacdgIFfDNi/7ZgJFFwoN05CK4FUvMrufn3b+BwEUpoo9f21D6Wc8h3oJuGLIZlNeW/3WkI3/q3noJ6yEuRc7jjVEwKTAAAAA==", Mustachio = class extends Player {
|
|
926
|
+
image = new Image();
|
|
927
|
+
isFire = !1;
|
|
928
|
+
isBig = !1;
|
|
929
|
+
hitTimer = null;
|
|
930
|
+
warpPipe = null;
|
|
931
|
+
canFire = !0;
|
|
932
|
+
crouched = !1;
|
|
933
|
+
ignoreUpdate = !1;
|
|
934
|
+
constructor(u, z, B) {
|
|
935
|
+
super(u, {
|
|
936
|
+
x: z,
|
|
937
|
+
y: B,
|
|
938
|
+
width: 60 * .66,
|
|
939
|
+
height: 60 * .66
|
|
940
|
+
}), this.image.src = Mustachio_default;
|
|
941
|
+
}
|
|
942
|
+
draw(u) {
|
|
943
|
+
u.drawImage(this.image, this.rect.x, this.rect.y, this.rect.width, this.rect.height);
|
|
944
|
+
}
|
|
945
|
+
update(z) {
|
|
946
|
+
if (!this.ignoreUpdate) {
|
|
947
|
+
this.blockedDirHor = direction.NONE, this.blockedDirVert = direction.NONE, this.warpPipe = null;
|
|
948
|
+
for (let u of z) this.handleCollision(u);
|
|
949
|
+
this.handleGravity();
|
|
950
|
+
}
|
|
951
|
+
}
|
|
952
|
+
goDownPipe() {
|
|
953
|
+
if (this.warpPipe === null) return;
|
|
954
|
+
this.ignoreUpdate = !0, this.rect.x = this.warpPipe.rect.x + this.warpPipe.rect.width / 2 - this.rect.width / 2 + this.gameContext.xOffset, this.rect.y = this.warpPipe.rect.y - this.rect.height;
|
|
955
|
+
let u = null;
|
|
956
|
+
u = setInterval(() => {
|
|
957
|
+
if (!this.warpPipe) {
|
|
958
|
+
u && clearInterval(u);
|
|
959
|
+
return;
|
|
960
|
+
}
|
|
961
|
+
this.rect.y += 5, this.rect.y >= this.warpPipe.rect.y && (u && clearInterval(u), this.warpPipe.enter(), this.warpPipe = null, this.ignoreUpdate = !1);
|
|
962
|
+
}, 50);
|
|
963
|
+
}
|
|
964
|
+
reset(u, z) {
|
|
965
|
+
this.rect.x = u ?? 60 * 4.5, this.rect.y = z ?? 300;
|
|
966
|
+
}
|
|
967
|
+
changeSize(u) {
|
|
968
|
+
if (this.isBig === u) return;
|
|
969
|
+
this.isBig = u;
|
|
970
|
+
let z = 0, B = null;
|
|
971
|
+
B = setInterval(() => {
|
|
972
|
+
++z > 3 && B && clearInterval(B), this.isBig ? (this.rect.height += 10, this.rect.y -= 10, this.rect.width += 3, this.rect.x -= 1.5) : (this.rect.height -= 10, this.rect.y += 10, this.rect.width -= 3, this.rect.x += 1.5);
|
|
973
|
+
}, 115);
|
|
974
|
+
}
|
|
975
|
+
changeFire(u) {
|
|
976
|
+
if (this.isFire === u) return;
|
|
977
|
+
this.isFire = u, this.isFire && !this.isBig && this.changeSize(!0);
|
|
978
|
+
let z = 0, B = null;
|
|
979
|
+
B = setInterval(() => {
|
|
980
|
+
if (z < 6) {
|
|
981
|
+
z++, this.isFire = !this.isFire;
|
|
982
|
+
return;
|
|
983
|
+
}
|
|
984
|
+
B && clearInterval(B);
|
|
985
|
+
}, 115);
|
|
986
|
+
}
|
|
987
|
+
handleCollision(u) {
|
|
988
|
+
u.gameObject instanceof UpdatingGameObject && !u.gameObject.acceptsCollision || (this.handleCollisionGameObject(u), this.handleCollisionDirection(u));
|
|
989
|
+
}
|
|
990
|
+
handleCollisionDirection(z) {
|
|
991
|
+
if (z.gameObject instanceof ItemBlock && z.gameObject.hidden || z.gameObject instanceof Item) return;
|
|
992
|
+
let B = z.gameObject.rect;
|
|
993
|
+
(z.gameObject instanceof Floor || z.gameObject instanceof CaveWall && this.rect.y < B.y) && (this.rect.x + this.rect.width < B.x + this.gameContext.xOffset ? z.collisionDirection = direction.LEFT : this.rect.x > B.x + B.width + this.gameContext.xOffset ? z.collisionDirection = direction.RIGHT : z.collisionDirection = direction.DOWN);
|
|
994
|
+
let V = this.rect.x + this.rect.width > B.x + 10 + this.gameContext.xOffset;
|
|
995
|
+
V &&= this.rect.x < B.x + B.width - 10 + this.gameContext.xOffset, V && z.collisionDirection === direction.DOWN ? (this.blockedDirVert = direction.DOWN, this.landOnGameObject(z.gameObject)) : V && z.collisionDirection === direction.UP ? (this.speedY = 1, this.rect.y = B.y + B.height - 1, this.blockedDirVert = direction.UP) : z.collisionDirection === direction.LEFT && this.gameContext.currentDir === direction.LEFT ? (this.speedX = 0, this.rect.x = B.x - this.rect.width + 1 + this.gameContext.xOffset, this.blockedDirHor = direction.LEFT) : z.collisionDirection === direction.RIGHT && this.gameContext.currentDir === direction.RIGHT && (this.speedX = 0, this.rect.x = B.x + B.width - 1 + this.gameContext.xOffset, this.blockedDirHor = direction.RIGHT);
|
|
996
|
+
}
|
|
997
|
+
handleCollisionGameObject(u) {
|
|
998
|
+
let z = u.gameObject;
|
|
999
|
+
if (z instanceof FireBar || z instanceof EnemyProjectile) {
|
|
1000
|
+
this.playerHit();
|
|
1001
|
+
return;
|
|
1002
|
+
}
|
|
1003
|
+
if (z instanceof SetPiece) {
|
|
1004
|
+
this.handleCollisionSetPiece(u.collisionDirection, z);
|
|
1005
|
+
return;
|
|
1006
|
+
}
|
|
1007
|
+
if (z instanceof Enemy) {
|
|
1008
|
+
this.handleCollisionEnemy(u.collisionDirection, z);
|
|
1009
|
+
return;
|
|
1010
|
+
}
|
|
1011
|
+
if (z instanceof Item) {
|
|
1012
|
+
this.handleCollisionItem(z);
|
|
1013
|
+
return;
|
|
1014
|
+
}
|
|
1015
|
+
}
|
|
1016
|
+
handleCollisionItem(u) {
|
|
1017
|
+
u.collect(), u instanceof Stacheroom ? this.changeSize(!0) : u instanceof FireStache && this.changeFire(!0);
|
|
1018
|
+
}
|
|
1019
|
+
handleCollisionEnemy(z, B) {
|
|
1020
|
+
if (B instanceof StacheSeed) !B.isDead && !B.inPipe && this.playerHit();
|
|
1021
|
+
else if (z !== direction.DOWN) {
|
|
1022
|
+
B.isDead || this.playerHit();
|
|
1023
|
+
return;
|
|
1024
|
+
} else z === direction.DOWN && (this.landOnGameObject(B), B.enemyHit());
|
|
1025
|
+
}
|
|
1026
|
+
handleCollisionSetPiece(z, B) {
|
|
1027
|
+
if (B instanceof Flag) {
|
|
1028
|
+
this.winGame(B);
|
|
1029
|
+
return;
|
|
1030
|
+
}
|
|
1031
|
+
z === direction.DOWN && B instanceof Obstacle ? this.handleCollisionObstacle(B) : this.speedY <= 0 && z === direction.UP && B instanceof PunchableBlock && ((!(B instanceof Brick) || this.isBig) && B.punch(), this.speedY = 1);
|
|
1032
|
+
}
|
|
1033
|
+
handleCollisionObstacle(u) {
|
|
1034
|
+
u instanceof FallingFloor && u.startFall(), u instanceof WarpPipe && (this.warpPipe = u);
|
|
1035
|
+
}
|
|
1036
|
+
toggleCrouch(u) {
|
|
1037
|
+
if (this.crouched === u) return;
|
|
1038
|
+
this.crouched = u;
|
|
1039
|
+
let z;
|
|
1040
|
+
z = u ? -(this.rect.height / 2) : this.rect.height, this.rect.y -= z, this.rect.height += z;
|
|
1041
|
+
}
|
|
1042
|
+
playerHit() {
|
|
1043
|
+
this.hitTimer === null && (this.isFire ? this.changeFire(!1) : this.isBig ? (this.toggleCrouch(!1), this.changeSize(!1)) : this.playerKill(), this.hitTimer = setTimeout(() => {
|
|
1044
|
+
this.hitTimer = null;
|
|
1045
|
+
}, 1e3));
|
|
1046
|
+
}
|
|
1047
|
+
playerKill() {
|
|
1048
|
+
this.gameContext.setGameOver(), this.ignoreUpdate = !0, this.image.src = Mustachio_default, setTimeout(() => {
|
|
1049
|
+
this.speedY = -5;
|
|
1050
|
+
let u = setInterval(() => {
|
|
1051
|
+
this.rect.y += this.speedY, this.speedY += .06, this.rect.y > this.gameContext.gameArea.height && (clearInterval(u), this.gameContext.removeGameObject(this), this.gameContext.stopMainLoop());
|
|
1052
|
+
});
|
|
1053
|
+
}, 1e3);
|
|
1054
|
+
}
|
|
1055
|
+
customKeyDown(z) {
|
|
1056
|
+
if (z === "") {
|
|
1057
|
+
if (!this.isFire || !this.canFire) return;
|
|
1058
|
+
this.canFire = !1, setTimeout(() => {
|
|
1059
|
+
this.canFire = !0;
|
|
1060
|
+
}, 250);
|
|
1061
|
+
let z = new StacheBall(this.gameContext, this.rect.x + this.rect.width + 5, this.rect.y + this.rect.height / 2);
|
|
1062
|
+
z.speedX = this.gameContext.currentDir === direction.LEFT ? -5 : 5, z.speedY = 0, this.gameContext.addGameObject(z);
|
|
1063
|
+
} else z === "arrowdown" || z === "s" ? this.warpPipe ? (this.isFire ? this.image.src = Mustachio_Fire_default : this.image.src = Mustachio_default, this.goDownPipe()) : this.toggleCrouch(!0) : z === "arrowleft" || z === "a" ? this.isFire ? this.image.src = Mustachio_FacingLeft_Fire_default : this.image.src = Mustachio_FacingLeft_default : (z === "arrowright" || z === "d") && (this.isFire ? this.image.src = Mustachio_FacingRight_Fire_default : this.image.src = Mustachio_FacingRight_default);
|
|
1064
|
+
}
|
|
1065
|
+
customKeyUp(u) {
|
|
1066
|
+
(u === "arrowdown" || u === "s") && this.toggleCrouch(!1);
|
|
1067
|
+
}
|
|
1068
|
+
winGame(u) {
|
|
1069
|
+
this.ignoreUpdate = !0, this.gameContext.setGameOver(), this.image.src = Mustachio_FacingRight_default;
|
|
1070
|
+
let z = u.rect.x + u.rect.width / 2 - this.rect.width / 1.5 + this.gameContext.xOffset, B = setInterval(() => {
|
|
1071
|
+
this.rect.y + this.rect.height < 1020 && (this.rect.y += this.speedY, this.speedY += this.gameContext.gravity), this.rect.x > z && (clearInterval(B), this.image.src = Mustachio_default, setTimeout(() => {
|
|
1072
|
+
u.closeDoor(), this.gameContext.removeGameObject(this), this.gameContext.win();
|
|
1073
|
+
}, 1e3)), this.rect.x += 1.5;
|
|
1074
|
+
}, 5);
|
|
1075
|
+
}
|
|
1076
|
+
}, ScoreDisplay = class extends UIObject {
|
|
1077
|
+
draw(u) {
|
|
1078
|
+
u.clearRect(0, 0, this.gameContext.gameArea.width / 2, 100), u.fillStyle = "white", u.font = "40px Arial", u.fillText(`Score: ${this.gameContext.score}`, this.rect.x, this.rect.y);
|
|
1079
|
+
}
|
|
1080
|
+
}, TimerDisplay = class extends UIObject {
|
|
1081
|
+
draw(u) {
|
|
1082
|
+
u.clearRect(this.gameContext.gameArea.width / 2, 0, this.gameContext.gameArea.width / 2, 100), u.fillStyle = "white", u.font = "40px Arial", u.fillText(`Time: ${this.gameContext.time}`, this.rect.x, this.rect.y);
|
|
1083
|
+
}
|
|
1084
|
+
}, MustachioGameContext = class extends GameContext {
|
|
1085
|
+
timeDisplay;
|
|
1086
|
+
scoreDisplay;
|
|
1087
|
+
gameName = "Mustachio";
|
|
1088
|
+
player;
|
|
1089
|
+
constructor(u) {
|
|
1090
|
+
super(u), this.player = new Mustachio(this, 240, 780), this.addGameObject(this.player), this.scoreDisplay = new ScoreDisplay(this, 60, 60), this.timeDisplay = new TimerDisplay(this, 1680, 60), this.scoreDisplay.draw(this.uiContext), this.timeDisplay.draw(this.uiContext), this.addBgObject(new Background(this)), this.addBgObject(new Cloud(this, 120, 120)), this.addBgObject(new Cloud(this, 480, 180)), this.addBgObject(new Cloud(this, 900, 60)), this.addBgObject(new Cloud(this, 1380, 240)), this.addBgObject(new Cloud(this, 1620, 120));
|
|
1091
|
+
}
|
|
1092
|
+
};
|
|
1093
|
+
const startMustachio = (u) => {
|
|
1094
|
+
new MustachioGameContext(u).restart(levelOne);
|
|
1095
|
+
};
|
|
1096
|
+
export { startMustachio };
|
package/package.json
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mustachio-game",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
|
-
"files": [
|
|
6
|
+
"files": [
|
|
7
|
+
"dist"
|
|
8
|
+
],
|
|
7
9
|
"exports": {
|
|
8
10
|
".": {
|
|
9
11
|
"import": "./dist/index.js"
|
|
@@ -13,7 +15,9 @@
|
|
|
13
15
|
"dev": "vite",
|
|
14
16
|
"lint": "eslint . --fix",
|
|
15
17
|
"build": "tsc && vite build",
|
|
16
|
-
"preview": "vite preview"
|
|
18
|
+
"preview": "vite preview",
|
|
19
|
+
"patch": "npm version patch --no-git-tag-version",
|
|
20
|
+
"prepublishOnly": "npm run build"
|
|
17
21
|
},
|
|
18
22
|
"devDependencies": {
|
|
19
23
|
"@eslint/js": "^9.39.2",
|