Files
pathduck.github.io/vivaldia/vivaldia-worker.js
T
2020-11-19 19:47:03 +01:00

2167 lines
168 KiB
JavaScript
Executable File

! function() {
"use strict";
var e, t, k, i;
(t = e = e || {})[t.VivaldiNameSpaceFound = 100] = "VivaldiNameSpaceFound", t[t.VivaldiaWorkerInitialized = 101] = "VivaldiaWorkerInitialized", t[t.RequestToScreenshot = 102] = "RequestToScreenshot", (i = k = k || {})[i.Static = 0] = "Static", i[i.Dynamic = 1] = "Dynamic";
var a = (s.prototype.set = function(t, i) {
this._originalWidth = t, this._originalHeight = i, this._width = this._originalWidth * this._entity._scaleX, this._height = this._originalHeight * this._entity._scaleY, this._centerX = .5 * this._width, this._centerY = .5 * this._height
}, s.prototype.reset = function() {
this._hitCount = 0, this.touchingTop = !1, this.touchingLeft = !1, this.touchingRight = !1, this.touchingBottom = !1
}, s);
function s(t, i, e) {
this._entity = t, this.type = k.Static, this.active = !0, this._width = 0, this._height = 0, this._originalWidth = 0, this._originalHeight = 0, this._centerX = 0, this._centerY = 0, this.offsetX = 0, this.offsetY = 0, this._hits = [], this._hitCount = 0, this.tagFilter = -1, this.collisionEdgeTop = !0, this.collisionEdgeLeft = !0, this.collisionEdgeRight = !0, this.collisionEdgeBottom = !0, this.touchingTop = !1, this.touchingLeft = !1, this.touchingRight = !1, this.touchingBottom = !1, this.slope = 0, this.slopeNumber = 0, this.slopeOffsetTop = 0, this.slopeOffsetLeft = 0, this.slopeOffsetRight = 0, this.slopeOffsetBottom = 0, this.safeAreaTop = 0, this.safeAreaLeft = 0, this.safeAreaRight = 0, this.safeAreaBottom = 0, this.set(i, e)
}
function u(t, i, e, s, a) {
void 0 === a && (a = new Float32Array(16));
var o = t[0],
n = t[1],
r = t[2],
h = t[3],
_ = t[4],
l = t[5],
d = t[6],
c = t[7],
p = t[8],
u = t[9],
f = t[10],
g = t[11],
y = t[12],
m = t[13],
v = t[14],
x = t[15];
return t !== a && (a[0] = o, a[1] = n, a[2] = r, a[3] = h, a[4] = _, a[5] = l, a[6] = d, a[7] = c, a[8] = p, a[9] = u, a[10] = f, a[11] = g), a[12] = o * i + _ * e + p * s + y, a[13] = n * i + l * e + u * s + m, a[14] = r * i + d * e + f * s + v, a[15] = h * i + c * e + g * s + x, a
}
function f(t, i, e, s, a) {
return void 0 === a && (a = new Float32Array(16)), a[0] = i * t[0], a[1] = i * t[1], a[2] = i * t[2], a[3] = i * t[3], a[4] = e * t[4], a[5] = e * t[5], a[6] = e * t[6], a[7] = e * t[7], a[8] = s * t[8], a[9] = s * t[9], a[10] = s * t[10], a[11] = s * t[11], t !== a && (a[12] = t[12], a[13] = t[13], a[14] = t[14], a[15] = t[15]), a
}
function o(t, i) {
for (var e = [], s = 0; s < i.length; s++) {
var a = 0 == s ? t.VERTEX_SHADER : t.FRAGMENT_SHADER,
o = function(t, i, e) {
var s = t.createShader(e);
if (!s) return console.error("failed to load shader"), null;
if (t.shaderSource(s, i), t.compileShader(s), t.getShaderParameter(s, t.COMPILE_STATUS)) return s;
var a = t.getShaderInfoLog(s);
return console.error("Shader Error '" + s + "':" + a), t.deleteShader(s), null
}(t, i[s], a);
o && e.push(o)
}
return function(i, t) {
var e = i.createProgram();
if (!e) return console.error("failed to create WebGL program"), null;
if (t.forEach(function(t) {
i.attachShader(e, t)
}), i.linkProgram(e), i.getProgramParameter(e, i.LINK_STATUS)) return e;
var s = i.getProgramInfoLog(e);
return console.error("Error linking:" + s), i.deleteProgram(e), null
}(t, e)
}
var w = (n.init = function() {
var t;
this._stack = [], this._currentStackPosition = 0, this._r = 1, this._g = 1, this._b = 1, this._a = 1, this._mainMatrix = new Float32Array(16), this._spriteMatrix = new Float32Array(16), this._textures = {}, this._stack[0] = (void 0 === t && (t = new Float32Array(16)), t[0] = 1, t[1] = 0, t[2] = 0, t[3] = 0, t[4] = 0, t[5] = 1, t[6] = 0, t[7] = 0, t[8] = 0, t[9] = 0, t[10] = 1, t[11] = 0, t[12] = 0, t[13] = 0, t[14] = 0, t[15] = 1, t);
var i = lt._canvas.getContext("webgl", {
alpha: !0,
premultipliedAlpha: !0
});
null != i && (this._gl = i), this._gl.clearColor(0, 0, 0, 1), this._gl.enable(this._gl.BLEND), this._gl.blendFunc(this._gl.SRC_ALPHA, this._gl.ONE_MINUS_SRC_ALPHA);
var e, s, a = o(this._gl, ["\nattribute vec4 a_position;\nattribute vec2 a_texcoord;\n\nuniform mat4 u_matrix;\nuniform mat4 u_textureMatrix;\n\nvarying vec2 v_texcoord;\n\nvoid main() {\n gl_Position = u_matrix * a_position;\n v_texcoord = (u_textureMatrix * vec4(a_texcoord, 0, 1)).xy;\n}\n", "\nprecision mediump float;\n\nvarying vec2 v_texcoord;\n\nuniform bool u_noTexture;\nuniform sampler2D texture;\nuniform vec4 u_color;\n\nvoid main() {\n if(u_noTexture) {\n gl_FragColor = u_color;\n }\n else {\n gl_FragColor = texture2D(texture, v_texcoord) * u_color;\n }\n}\n"]);
a ? (this._positionLocation = this._gl.getAttribLocation(a, "a_position"), this._texcoordLocation = this._gl.getAttribLocation(a, "a_texcoord"), this._matrixLocation = this._gl.getUniformLocation(a, "u_matrix"), this._textureMatrixLocation = this._gl.getUniformLocation(a, "u_textureMatrix"), this._textureLocation = this._gl.getUniformLocation(a, "u_texture"), this._colorLocation = this._gl.getUniformLocation(a, "u_color"), this._noTextureLocation = this._gl.getUniformLocation(a, "u_noTexture"), e = this._gl.createBuffer(), this._gl.bindBuffer(this._gl.ARRAY_BUFFER, e), this._gl.bufferData(this._gl.ARRAY_BUFFER, new Float32Array([0, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 1]), this._gl.STATIC_DRAW), s = this._gl.createBuffer(), this._gl.bindBuffer(this._gl.ARRAY_BUFFER, s), this._gl.bindBuffer(this._gl.ARRAY_BUFFER, s), this._gl.enableVertexAttribArray(this._texcoordLocation), this._gl.vertexAttribPointer(this._texcoordLocation, 2, this._gl.FLOAT, !1, 0, 0), this._gl.bufferData(this._gl.ARRAY_BUFFER, new Float32Array([0, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 1]), this._gl.STATIC_DRAW), this._gl.bindBuffer(this._gl.ARRAY_BUFFER, e), this._gl.enableVertexAttribArray(this._positionLocation), this._gl.vertexAttribPointer(this._positionLocation, 2, this._gl.FLOAT, !1, 0, 0), this._gl.useProgram(a), this._gl.viewport(0, 0, lt._canvas.width, lt._canvas.height), this._gl.uniform1i(this._textureLocation, 0)) : console.error("failed to create shader program from sources")
}, n.restore = function() {
this._currentStackPosition--
}, n.save = function() {
this._currentStackPosition++, this._stack[this._currentStackPosition] = this._stack[this._currentStackPosition - 1]
}, n._getCurrentMatrix = function() {
return this._stack[this._currentStackPosition]
}, n._setCurrentMatrix = function(t) {
return this._stack[this._currentStackPosition] = t
}, n.translate = function(t, i, e) {
void 0 === e && (e = 0);
var s = this._getCurrentMatrix();
this._setCurrentMatrix(u(s, t, i, e, this._mainMatrix))
}, n.rotateZ = function(t) {
var i = this._getCurrentMatrix();
this._setCurrentMatrix(function(t, i, e) {
void 0 === e && (e = new Float32Array(16));
var s = t[0],
a = t[1],
o = t[2],
n = t[3],
r = t[4],
h = t[5],
_ = t[6],
l = t[7],
d = Math.cos(i),
c = Math.sin(i);
return e[0] = d * s + c * r, e[1] = d * a + c * h, e[2] = d * o + c * _, e[3] = d * n + c * l, e[4] = d * r - c * s, e[5] = d * h - c * a, e[6] = d * _ - c * o, e[7] = d * l - c * n, t !== e && (e[8] = t[8], e[9] = t[9], e[10] = t[10], e[11] = t[11], e[12] = t[12], e[13] = t[13], e[14] = t[14], e[15] = t[15]), e
}(i, t, this._mainMatrix))
}, n.scale = function(t, i, e) {
void 0 === e && (e = 1);
var s = this._getCurrentMatrix();
this._setCurrentMatrix(f(s, t, i, e, this._mainMatrix))
}, n.setDrawColor = function(t, i, e, s) {
this._r = t, this._g = i, this._b = e, this._a = s
}, n.drawRect = function(t, i, e, s) {
this._gl.bindTexture(this._gl.TEXTURE_2D, null), this._gl.uniform1i(this._noTextureLocation, 1), this._drawObject(t, i, e, s, !1, !1)
}, n.drawSprite = function(t, i, e, s, a, o, n) {
void 0 === s && (s = 0), void 0 === a && (a = 0), void 0 === o && (o = t._texture._image.width), void 0 === n && (n = t._texture._image.height);
var r, h, _, l, d = f(d = (r = s / t._texture._image.width, h = a / t._texture._image.height, void(_ = 0) === (l = this._spriteMatrix) && (l = new Float32Array(16)), l[0] = 1, l[1] = 0, l[2] = 0, l[3] = 0, l[4] = 0, l[5] = 1, l[6] = 0, l[7] = 0, l[8] = 0, l[9] = 0, l[10] = 1, l[11] = 0, l[12] = r, l[13] = h, l[14] = _, l[15] = 1, l), o / t._texture._image.width, n / t._texture._image.height, 1, d);
this._gl.uniformMatrix4fv(this._textureMatrixLocation, !1, d), this._gl.bindTexture(this._gl.TEXTURE_2D, t._texture._webGLTexture), this._gl.uniform1i(this._noTextureLocation, 0), this._drawObject(i, e, o, n, t.flipX, t.flipY)
}, n._drawObject = function(t, i, e, s, a, o) {
var n, r, h, _, l, d, c, p = (n = 0, r = this._gl.canvas.width, h = this._gl.canvas.height, l = -10, d = 10, void(_ = 0) === (c = this._spriteMatrix) && (c = new Float32Array(16)), c[0] = 2 / (r - n), c[1] = 0, c[2] = 0, c[3] = 0, c[4] = 0, c[5] = 2 / (_ - h), c[6] = 0, c[7] = 0, c[8] = 0, c[9] = 0, c[10] = 2 / (l - d), c[11] = 0, c[12] = (n + r) / (n - r), c[13] = (h + _) / (h - _), c[14] = (l + d) / (l - d), c[15] = 1, c);
p = f(p = u(p = function(t, i, e) {
void 0 === e && (e = new Float32Array(16));
var s = i[0],
a = i[1],
o = i[2],
n = i[3],
r = i[4],
h = i[5],
_ = i[6],
l = i[7],
d = i[8],
c = i[9],
p = i[10],
u = i[11],
f = i[12],
g = i[13],
y = i[14],
m = i[15],
v = t[0],
x = t[1],
S = t[2],
T = t[3],
w = t[4],
b = t[5],
D = t[6],
A = t[7],
P = t[8],
C = t[9],
B = t[10],
F = t[11],
E = t[12],
k = t[13],
U = t[14],
X = t[15];
return e[0] = s * v + a * w + o * P + n * E, e[1] = s * x + a * b + o * C + n * k, e[2] = s * S + a * D + o * B + n * U, e[3] = s * T + a * A + o * F + n * X, e[4] = r * v + h * w + _ * P + l * E, e[5] = r * x + h * b + _ * C + l * k, e[6] = r * S + h * D + _ * B + l * U, e[7] = r * T + h * A + _ * F + l * X, e[8] = d * v + c * w + p * P + u * E, e[9] = d * x + c * b + p * C + u * k, e[10] = d * S + c * D + p * B + u * U, e[11] = d * T + c * A + p * F + u * X, e[12] = f * v + g * w + y * P + m * E, e[13] = f * x + g * b + y * C + m * k, e[14] = f * S + g * D + y * B + m * U, e[15] = f * T + g * A + y * F + m * X, e
}(p, this._getCurrentMatrix(), p), a ? -t : t, o ? -i : i, 0, p), a ? -e : e, o ? -s : s, 1, p), this._gl.uniformMatrix4fv(this._matrixLocation, !1, p), this._gl.uniform4f(this._colorLocation, this._r, this._g, this._b, this._a), this._gl.drawArrays(this._gl.TRIANGLES, 0, 6)
}, n.createTexture = function(t, i) {
if (this._textures[t]) return this._textures[t];
var e = this._gl.createTexture();
if (null != e) {
var s = e;
return this._gl.bindTexture(this._gl.TEXTURE_2D, s), this._gl.texImage2D(this._gl.TEXTURE_2D, 0, this._gl.RGBA, this._gl.RGBA, this._gl.UNSIGNED_BYTE, i), this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_WRAP_S, this._gl.CLAMP_TO_EDGE), this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_WRAP_T, this._gl.CLAMP_TO_EDGE), this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_MIN_FILTER, this._gl.NEAREST), this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_MAG_FILTER, this._gl.NEAREST), this._gl.pixelStorei(this._gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, !0), this._textures[t] = s
}
}, n.clear = function() {
this._gl.clear(this._gl.COLOR_BUFFER_BIT | this._gl.DEPTH_BUFFER_BIT)
}, n);
function n() {}
var r = (h.init = function() {
this._images = {}, this._imagesTotal = 0, this._imagesLoaded = 0, this._loadedCallback = null
}, h.setOnLoadedCallback = function(t) {
this._loadedCallback = t
}, h.createImage = function(i) {
var e = this;
this._imagesTotal++,
function(t, i, e) {
void 0 === e && (e = "");
var s = new XMLHttpRequest;
s.onload = function() {
i(s.response)
}, s.onerror = function() {
console.error("error trying to get url: " + t), i(null)
}, s.open("GET", t), s.responseType = e, s.send()
}(i, function(t) {
createImageBitmap(t).then(function(t) {
e._images[i] = t, e._imagesLoaded++, e._runCallbackIfLoaded()
})
}, "blob")
}, h._runCallbackIfLoaded = function() {
null != this._loadedCallback && this._imagesTotal == this._imagesLoaded && (this._loadedCallback(), this._loadedCallback = null)
}, h);
function h() {}
var m = function(t, i, e, s, a) {
void 0 === i && (i = null), void 0 === e && (e = null), void 0 === s && (s = 0), void 0 === a && (a = 0), this._image = r._images[t], this._drawWidth = i || this._image.width, this._drawHeight = e || this._image.height, this._drawFromX = s, this._drawFromY = a, this._halfWidth = .5 * this._drawWidth, this._halfHeight = .5 * this._drawHeight, this.colorTintR = 1, this.colorTintG = 1, this.colorTintB = 1, this.colorTintA = 1;
var o = w.createTexture(t, this._image);
if (!o) return this._webGLTexture = null, void console.error("failed to create texture");
this._webGLTexture = o
},
_ = function(t, i, e, s) {
void 0 === e && (e = 0), void 0 === s && (s = 0), this.texture = t, this.duration = i, this.addToSpriteOffsetX = e, this.addToSpriteOffsetY = s
},
l = (d.prototype.setTexture = function(t) {
this._texture = t
}, d.prototype.repeatAnimation = function(t) {
this._repeatAnimation = t, this._isAnimating = t
}, d.prototype.playAnimation = function() {
this._currentFrame = -1, this._isAnimating = !0
}, d.prototype.fixedUpdate = function() {
var t;
this._isAnimating && 0 < this._animationCount && this._nextAnimationTime <= nt._lastUpdateTime && (this._currentFrame++, this._currentFrame == this._animationCount && (this.animationFinishedCallback(), this._repeatAnimation ? this._currentFrame = 0 : (this._isAnimating = !1, this._currentFrame = -1)), this._isAnimating && (null == (t = this._animation[this._currentFrame]) ? console.error("sprite animation needs to be cleared!") : (this._texture = t.texture, this._nextAnimationTime = nt._lastUpdateTime + t.duration, this.drawOffsetX += t.addToSpriteOffsetX, this.drawOffsetY += t.addToSpriteOffsetY))), 0 < this._frameCountX && this._updateOnNextFrameNumberX <= nt._fixedUpdateCount && (this._updateOnNextFrameNumberX = nt._fixedUpdateCount + this._updateDelayX, this._currentFrameX += 1, this._currentFrameX == this._frameCountX && (this._animationLoopX ? this.setAnimationX(this._updateDelayX, this._frameCountX) : (this._currentFrameX = this._frameCountX - 1, this._frameCountX = 0))), 0 < this._frameCountY && this._updateOnNextFrameNumberY <= nt._fixedUpdateCount && (this._updateOnNextFrameNumberY = nt._fixedUpdateCount + this._updateDelayY, this._currentFrameY += 1, this._currentFrameY == this._frameCountY && (this._animationLoopY ? this.setAnimationY(this._updateDelayY, this._frameCountY) : (this._currentFrameY = this._frameCountY - 1, this._frameCountY = 0)))
}, d.prototype.setAnimationX = function(t, i, e) {
void 0 === e && (e = !0), this._frameCountX = i, this._updateDelayX = t, this._currentFrameX = 0, this._animationLoopX = e, this._updateOnNextFrameNumberX = nt._fixedUpdateCount + this._updateDelayX
}, d.prototype.setAnimationY = function(t, i, e) {
void 0 === e && (e = !0), this._frameCountY = i, this._updateDelayY = t, this._currentFrameY = 0, this._animationLoopY = e, this._updateOnNextFrameNumberY = nt._fixedUpdateCount + this._updateDelayY
}, d.prototype.addAnimationFrame = function(t, i, e, s) {
void 0 === e && (e = 0), void 0 === s && (s = 0), this._animation[this._animationCount] ? (this._animation[this._animationCount].texture = t, this._animation[this._animationCount].duration = i) : this._animation[this._animationCount] = new _(t, i, e, s), this._animationCount++
}, d.prototype.clearAnimation = function() {
this._animationCount = 0, this._currentFrame = 0
}, d.prototype.resetAnimationX = function() {
this._currentFrameX = 0, this._frameCountX = 0
}, d.prototype.resetAnimationY = function() {
this._currentFrameY = 0, this._frameCountY = 0
}, d);
function d(t, i, e) {
void 0 === i && (i = 0), void 0 === e && (e = 0), this.active = !0, this._frameCountX = 0, this._frameCountY = 0, this._updateDelayX = 0, this._updateDelayY = 0, this._animationLoopX = !0, this._animationLoopY = !0, this._animation = [], this._animationCount = 0, this._currentFrame = -1, this._currentFrameX = 0, this._currentFrameY = 0, this._updateOnNextFrameNumberX = 0, this._updateOnNextFrameNumberY = 0, this._texture = t, this.drawOffsetX = i, this.drawOffsetY = e, this.flipX = !1, this.flipY = !1, this._nextAnimationTime = -1, this._repeatAnimation = !0, this._isAnimating = !0, this.animationFinishedCallback = function() {}
}
var v = (c.prototype.fixedUpdate = function(t) {
var i = t._aabb.getCenterX() + this._paddingCenterX + this.startOffsetX,
e = t._aabb.getWidth() + this._paddingWidthX,
s = this._currentRepeatCountX * e,
a = ht._x * this._parallaxSpeedX,
o = t.x + t._aabb.x1 - this._paddingWidthX + this.triggerOffsetX,
n = t.x + t._aabb.x2 + this._paddingWidthX + this.triggerOffsetX;
t.x = a - i + s, ht._x > n ? (t.x += e, this._currentRepeatCountX++) : ht._x < o && (t.x -= e, this._currentRepeatCountX--)
}, c);
function c(t, i, e) {
void 0 === t && (t = 0), void 0 === i && (i = 0), void 0 === e && (e = 0), this._currentRepeatCountX = 0, this.startOffsetX = 0, this.triggerOffsetX = 0, this._parallaxSpeedX = t, this._paddingWidthX = i + e, this._paddingCenterX = -i + e
}
var p = function() {
this.active = !0, this.velocityX = 0, this.velocityY = 0, this._lastX = 0, this._lastY = 0, this.gravityEnabledX = !0, this.gravityEnabledY = !0
},
g = (y.prototype.getWidth = function() {
return -this.x1 + this.x2
}, y.prototype.getHeight = function() {
return -this.y1 + this.y2
}, y.prototype.getCenterX = function() {
return this.x1 + this.x2
}, y.prototype.getCenterY = function() {
return this.y1 + this.y2
}, y);
function y() {
this.x1 = 0, this.y1 = 0, this.x2 = 0, this.y2 = 0
}
var x = function(t, i, e, s, a, o, n, r) {
void 0 === s && (s = 0), void 0 === a && (a = 0), void 0 === o && (o = 32), void 0 === n && (n = 3), void 0 === r && (r = 32), this._charWidth = i, this._charHalfWidth = .5 * i, this._charHeight = e, this._charHalfHeight = .5 * e, this._textures = {};
for (var h = -1, _ = -1, l = 0; l < 96; l++) {
h++, l % o == 0 && (_++, h = 0);
var d = String.fromCharCode(l + r),
c = new m(t, i, e, s + h * i, a + _ * e);
this._textures[d] = c
}
},
S = (T.prototype.addSprite = function(t, i, e) {
void 0 === i && (i = 0), void 0 === e && (e = 0);
var s = new l(t, i, e);
return this._sprites.push(s), this._spriteCount++, this.calculateAABB(), s
}, T.prototype.addCollider = function(t, i) {
var e = new a(this, t, i);
this._colliders.push(e), this._colliderCount++;
for (var s = 0; s < 10; s++) e._hits.push(new a(this, 1, 1));
return e
}, T.prototype.calculateAABB = function() {
for (var t = 0; t < this._spriteCount; t++) {
var i = this._sprites[t],
e = i.drawOffsetX - i._texture._halfWidth,
s = i.drawOffsetY - i._texture._halfHeight,
a = i.drawOffsetX + i._texture._halfWidth,
o = i.drawOffsetY + i._texture._halfHeight;
this._aabb.x1 = 0 == t ? e : Math.min(e, this._aabb.x1), this._aabb.y1 = 0 == t ? s : Math.min(s, this._aabb.y1), this._aabb.x2 = 0 == t ? a : Math.max(a, this._aabb.x2), this._aabb.y2 = 0 == t ? o : Math.max(o, this._aabb.y2)
}
}, T.prototype.setActive = function(t) {
this._active != t && (this._active = t, this._currentObjectPool && (t ? this._currentObjectPool._availableCount-- : this._currentObjectPool._availableCount++))
}, T.prototype.setText = function(t, i) {
var e;
void 0 === i && (i = lt._defaultFont);
var s = t.length * i._charWidth * -.5;
this._spriteCount = t.length;
for (var a = 0; a < t.length; a++) this._sprites[a] ? this._sprites[a]._texture = i._textures[t[a]] : this._sprites[a] = new l(i._textures[t[a]]), this._sprites[a].drawOffsetX = s + i._charHalfWidth, s += i._charWidth;
(null === (e = this._text) || void 0 === e ? void 0 : e.length) != t.length && this.calculateAABB(), this._text = t
}, T.prototype.setScale = function(t, i) {
this._scaleX = t, this._scaleY = i;
for (var e = 0; e < this._colliderCount; e++) {
var s = this._colliders[e];
this._colliders[e].set(s._originalWidth, s._originalHeight)
}
}, T);
function T(t, i) {
this._id = -1, this._active = !0, this.x = t, this.y = i, this.tag = -1, this._layer = 0, this.rotation = 0, this._scaleX = 1, this._scaleY = 1, this._sprites = [], this._spriteCount = 0, this._colliders = [], this._colliderCount = 0, this._text = null, this.ui = !1, this._markedForRemoval = !1, this.fixedUpdate = null, this._currentObjectPool = null, this.colorTintR = 1, this.colorTintG = 1, this.colorTintB = 1, this.colorTintA = 1, this._aabb = new g, this.parallax = null, this.rigidBody = null
}
var b = Math.PI / 180,
D = (A.init = function() {
this._layerCount = 12, this._allEntities = [], this._uniqueId = 0, this._gravityX = 0, this._gravityY = 1, this._entitiesByLayers = [];
for (var t = 0; t < this._layerCount; t++) this._entitiesByLayers[t] = []
}, A.fixedUpdate = function() {
for (var t = this._allEntities.length - 1; 0 <= t; t--) {
if ((E = this._allEntities[t])._markedForRemoval) {
for (var i = 0; i < this._entitiesByLayers[E._layer].length; i++)
if (E._id == this._entitiesByLayers[E._layer][i]._id) {
this._entitiesByLayers[E._layer].splice(i, 1);
break
} this._allEntities.splice(t, 1)
}
if (E._active) {
E.rigidBody && E.rigidBody.active && (E.rigidBody._lastX = E.x, E.rigidBody._lastY = E.y, E.rigidBody.gravityEnabledX && (E.rigidBody.velocityX += this._gravityX), E.rigidBody.gravityEnabledY && (E.rigidBody.velocityY += this._gravityY), E.x += E.rigidBody.velocityX, E.y += E.rigidBody.velocityY);
for (var e = 0; e < E._colliders.length; e++) {
(u = E._colliders[e]).active && u.reset()
}
}
}
for (t = 0; t < this._allEntities.length; t++) {
if ((E = this._allEntities[t])._active) {
for (var s = 0; s < E._sprites.length; s++) {
var a = E._sprites[s];
a.active && a.fixedUpdate()
}
if (E.parallax && E.parallax.fixedUpdate(E), 0 < E._colliderCount)
for (var o = 0; o < E._colliderCount; o++) {
if ((u = E._colliders[o]).active && u.type != k.Static)
for (i = 0; i < this._allEntities.length; i++) {
var n = this._allEntities[i];
if (!(E.ui && !n.ui || !E.ui && n.ui) && (n._active && 0 < n._colliderCount))
for (var r, h, _, l, d = 0; d < n._colliderCount; d++) {
(g = n._colliders[d]).active && t != i && (-1 != E.tag && E.tag == g.tagFilter || -1 != n.tag && n.tag == u.tagFilter || (r = E.x, h = E.y, _ = n.x, l = n.y, r -= u._centerX - u.offsetX, h -= u._centerY - u.offsetY, _ -= g._centerX - g.offsetX, l -= g._centerY - g.offsetY, r < _ + g._width && r + u._width > _ && h < l + g._height && h + u._height > l && ((u._hits[u._hitCount++] = g)._hits[g._hitCount++] = u)))
}
}
}
}
}
for (t = 0; t < this._allEntities.length; t++) {
if ((E = this._allEntities[t])._active && E.rigidBody && E.rigidBody.active && 0 < E._colliderCount) {
var c = 0,
p = 0;
if (0 != E.rigidBody.velocityX || 0 != E.rigidBody.velocityY)
for (i = 0; i < E._colliderCount; i++)
for (var u = E._colliders[i], f = 0; f < u._hitCount; f++) {
var g, y, m, v, x, S, T, w, b, D, A, P, C, B, F, n = (g = u._hits[f])._entity;
0 < g.slope ? (0 < E.rigidBody.velocityX || 0 < E.rigidBody.velocityY) && (S = E.x + u._centerX + u.offsetX + u.slopeOffsetRight, A = E.y + u._centerY + u.offsetY + u.slopeOffsetBottom, D = n.x + g._centerX + g.offsetX + g.slopeOffsetRight, F = n.y + g._centerY + g.offsetY + g.slopeOffsetBottom, y = g._width + (S - D), m = g._height - (A - F), y = Math.ceil(y / Math.abs(g.slope)), (m -= Math.floor(_t._map._tileheight * g.slopeNumber / Math.abs(g.slope))) - g._height <= y && (v = -(y - (m - g._height)), u.touchingBottom = !0, g.touchingTop = !0, D < S && (v += S - D), p = Math.min(p, v))) : g.slope < 0 ? (E.rigidBody.velocityX < 0 || 0 < E.rigidBody.velocityY) && (w = E.x - u._centerX + u.offsetX - u.slopeOffsetLeft, A = E.y + u._centerY + u.offsetY - u.slopeOffsetBottom, T = n.x - g._centerX + g.offsetX - g.slopeOffsetLeft, F = n.y + g._centerY + g.offsetY - g.slopeOffsetBottom, y = g._width - (w - T), m = g._height - (A - F), y = Math.ceil(y / Math.abs(g.slope)), (m -= Math.floor(_t._map._tileheight * g.slopeNumber / Math.abs(g.slope))) - g._height <= y && (v = -(y - (m - g._height)), u.touchingBottom = !0, g.touchingTop = !0, w < T && (v += T - w), p = Math.min(p, v))) : (0 < E.rigidBody.velocityX && u.collisionEdgeRight && g.collisionEdgeLeft ? (x = E.rigidBody._lastX + u._centerX + u.offsetX - u.safeAreaRight, S = E.x + u._centerX + u.offsetX, x <= (T = n.x - g._centerX + g.offsetX) && (u.touchingRight = !0, g.touchingLeft = !0, c = Math.min(c, T - S))) : E.rigidBody.velocityX < 0 && u.collisionEdgeLeft && g.collisionEdgeRight && (w = E.x - u._centerX + u.offsetX, b = E.rigidBody._lastX - u._centerX + u.offsetX + u.safeAreaLeft, (D = n.x + g._centerX + g.offsetX) <= b && (u.touchingLeft = !0, g.touchingRight = !0, c = Math.max(c, D - w))), 0 < E.rigidBody.velocityY && u.collisionEdgeBottom && g.collisionEdgeTop ? (A = E.y + u._centerY + u.offsetY, E.rigidBody._lastY + u._centerY + u.offsetY - u.safeAreaBottom <= (P = n.y - g._centerY + g.offsetY) && (u.touchingBottom = !0, g.touchingTop = !0, p = Math.min(p, P - A))) : E.rigidBody.velocityY < 0 && u.collisionEdgeTop && g.collisionEdgeBottom && (C = E.y - u._centerY + u.offsetY, B = E.rigidBody._lastY - u._centerY + u.offsetY + u.safeAreaTop, (F = n.y + g._centerY + g.offsetY) <= B && (u.touchingTop = !0, g.touchingBottom = !0, p = Math.max(p, F - C))))
}
0 != c && (E.x += c, E.rigidBody.velocityX = 0), 0 != p && (E.y += p, E.rigidBody.velocityY = 0)
}
}
for (var E, t = 0; t < this._allEntities.length; t++) {
(E = this._allEntities[t])._active && E.fixedUpdate && E.fixedUpdate.fixedUpdate(E)
}
}, A.draw = function() {
w.clear();
for (var t = 0; t < this._layerCount; t++)
for (var i = 0; i < A._entitiesByLayers[t].length; i++) {
if ((g = A._entitiesByLayers[t][i])._active) {
w.save(), g.ui || (w.translate(-ht._x + rt._centerX, -ht._y + rt._centerY), w.rotateZ(ht.rotation * b)), w.translate(g.x, g.y), w.scale(g._scaleX, g._scaleY), w.rotateZ(g.rotation * b);
for (var e = 0; e < g._spriteCount; e++) {
var s, a, o, n, r, h, _, l, d, c, p, u, f = g._sprites[e];
f.active && (s = g.x + f._texture._halfWidth + f.drawOffsetX, a = g.x - f._texture._halfWidth + f.drawOffsetX, !g.ui && !g.parallax && (s < ht._worldLeft || a > ht._worldRight) || (o = Math.floor(-f._texture._halfWidth + f.drawOffsetX), n = Math.floor(-f._texture._halfHeight + f.drawOffsetY), r = f._texture._drawFromX + f._texture._drawWidth * f._currentFrameX, h = f._texture._drawFromY + f._texture._drawHeight * f._currentFrameY, _ = g.colorTintR * f._texture.colorTintR, l = g.colorTintG * f._texture.colorTintG, d = g.colorTintB * f._texture.colorTintB, c = g.colorTintA * f._texture.colorTintA, w.setDrawColor(_, l, d, c), w.drawSprite(f, o, n, r, h, f._texture._drawWidth, f._texture._drawHeight), g.parallax && (p = o - g._aabb.getWidth() - g.parallax._paddingWidthX, w.drawSprite(f, p, n, r, h, f._texture._drawWidth, f._texture._drawHeight), u = o + g._aabb.getWidth() + g.parallax._paddingWidthX, w.drawSprite(f, u, n, r, h, f._texture._drawWidth, f._texture._drawHeight))))
}
w.restore()
}
}
if (M._isActive)
for (t = 0; t < this._layerCount; t++)
for (var g, i = 0; i < A._entitiesByLayers[t].length; i++) {
if ((g = A._entitiesByLayers[t][i])._active) {
w.save(), g.ui || w.translate(-ht._x + rt._centerX, -ht._y + rt._centerY), w.translate(g.x, g.y), w.setDrawColor(1, 1, 1, .1), w.drawRect(g._aabb.x1, g._aabb.y1, g._aabb.getWidth(), 1), w.drawRect(g._aabb.x2, g._aabb.y1, 1, g._aabb.getHeight()), w.drawRect(g._aabb.x1, g._aabb.y2, g._aabb.getWidth(), 1), w.drawRect(g._aabb.x1, g._aabb.y1, 1, g._aabb.getHeight());
for (var y = 0; y < g._colliderCount; y++) {
var m, v, x, S, T = g._colliders[y];
T.active && (w.setDrawColor(0, 1, 0, .2), m = -T._centerX + T.offsetX, v = -T._centerY + T.offsetY, w.drawRect(m, v, T._width, T._height), T.collisionEdgeTop && w.drawRect(m, v, T._width, 1 + T.safeAreaTop), T.collisionEdgeLeft && w.drawRect(m, v, 1 + T.safeAreaLeft, T._height), T.collisionEdgeRight && (x = T.safeAreaRight, w.drawRect(m + T._width - 1 - x, v, 1 + x, T._height)), T.collisionEdgeBottom && (S = T.safeAreaBottom, w.drawRect(m, v + T._height - 1 - S, T._width, 1 + S)))
}
w.restore()
}
}
}, A);
function A() {}
var nt = (P.init = function() {
this._lastUpdateTime = 0, this._nextUpdateTime = 0, this._lastDrawTime = 0, this._fixedUpdateCount = 0, this._fixedDeltaTime = 1e3 / 60
}, P);
function P() {}
var C = (B.init = function(t, i) {
void 0 === t && (t = function() {}), void 0 === i && (i = function() {}), this._updateFn = t, this._drawFn = i, this._updateHz = 0, this._drawHz = 0, this._updatePerformanceInMs = 0, this._drawPerformanceInMs = 0, this._animationFrameHandle = requestAnimationFrame(B._mainLoop)
}, B._mainLoop = function(t) {
var i;
B._animationFrameHandle = requestAnimationFrame(B._mainLoop), B._drawHz = t - nt._lastDrawTime, (nt._lastDrawTime = t) > nt._nextUpdateTime && (B._updateHz = t - nt._lastUpdateTime, nt._lastUpdateTime = t, nt._nextUpdateTime = t + 13, i = performance.now(), B._updateFn(), nt._fixedUpdateCount++, 25 < B._updateHz && (B._updateFn(), nt._fixedUpdateCount++), B._updatePerformanceInMs = performance.now() - i);
var e = performance.now();
B._drawFn(), B._drawPerformanceInMs = performance.now() - e
}, B.shutDown = function() {
cancelAnimationFrame(this._animationFrameHandle)
}, B);
function B() {}
var rt = (F.init = function() {
this._width = lt._canvas.width, this._height = lt._canvas.height, this._centerX = .5 * this._width, this._centerY = .5 * this._height, this._scale = 1
}, F);
function F() {}
var E = function() {
this.axis = [], this.buttons = []
},
U = (X.init = function() {
this._keyDown = {}, this._mousePositionX = 0, this._mousePositionY = 0, this._mouseButtonDown = {}, this._touchDown = !1, this._leftThumbStickDown = !1, this._leftThumbStickX = 0, this._leftThumbStickY = 0, this._rightThumbStickDown = !1, this._rightThumbStickX = 0, this._rightThumbStickY = 0, this._gamepads = {}, this._gamepadsCount = 0
}, X.inputMessage = function(t) {
switch (t[0]) {
case W.KeyUp:
this._keyDown[t[1]] = !1;
break;
case W.KeyDown:
this._keyDown[t[1]] = !0;
break;
case W.TouchDown:
this._mousePositionX = t[1], this._mousePositionY = t[2], this._touchDown = !0;
break;
case W.TouchMove:
this._mousePositionX = t[1], this._mousePositionY = t[2];
break;
case W.TouchEnd:
this._mousePositionX = t[1], this._mousePositionY = t[2], this._touchDown = !1;
break;
case W.MouseDown:
this._mouseButtonDown[t[1]] = !0;
break;
case W.MouseUp:
this._mouseButtonDown[t[1]] = !1;
break;
case W.MouseMove:
this._mousePositionX = t[1], this._mousePositionY = t[2];
break;
case W.GamepadConnected:
this._gamepads[t[1]] = new E, this._gamepadsCount++;
break;
case W.GamepadDisconnected:
delete this._gamepads[t[1]], this._gamepadsCount--;
break;
case W.GamepadAxis:
this._gamepads[t[1]].axis[t[2]] = t[3];
break;
case W.GamepadButton:
this._gamepads[t[1]].buttons[t[2]] = t[3];
break;
case W.LeftThumbStickDown:
this._leftThumbStickDown = t[1];
break;
case W.LeftThumbStickX:
this._leftThumbStickX = t[1];
break;
case W.LeftThumbStickY:
this._leftThumbStickY = t[1];
break;
case W.RightThumbStickDown:
this._rightThumbStickDown = t[1];
break;
case W.RightThumbStickX:
case W.RightThumbStickX:
this._rightThumbStickX = t[1]
}
}, X);
function X() {}
var ht = (Y.init = function() {
this._x = 0, this._y = 0, this.offsetX = 0, this.offsetY = 0, this.rotation = 0, this.set(0, 0)
}, Y.set = function(t, i) {
this._x = t - Y.offsetX, this._y = i - Y.offsetY, this._worldTop = this._y - rt._centerY, this._worldBottom = this._y + rt._centerY, this._worldLeft = this._x - rt._centerX, this._worldRight = this._x + rt._centerX
}, Y);
function Y() {}
var R = (L.playSound = function(t) {
postMessage([W.PlaySound, t])
}, L.stopSound = function(t) {
postMessage([W.StopSound, t])
}, L.playMusic = function(t) {
postMessage([W.PlayMusic, t])
}, L.stopMusic = function(t) {
postMessage([W.StopMusic, t])
}, L);
function L() {}
var M = (O.init = function() {
this._textFrameDelay = 10, this._nextTextUpdateFrame = 0, this._isActive = !0, this._debugText = lt.createEntity(rt._centerX, rt._height - 6, 9), this._debugText.setText(""), this._debugText.colorTintR = 1, this._debugText.colorTintG = 0, this._debugText.colorTintB = 1, this._debugText.colorTintA = 1, this._debugText.ui = !0, this._debugText.setScale(.8, .8)
}, O.fixedUpdate = function() {
this._nextTextUpdateFrame < nt._fixedUpdateCount && (this._nextTextUpdateFrame = nt._fixedUpdateCount + this._textFrameDelay, this._debugText.setText("u:" + C._updateHz.toFixed(2) + "(" + C._updatePerformanceInMs.toFixed(2) + ") d:" + C._drawHz.toFixed(2) + "(" + C._drawPerformanceInMs.toFixed(2) + ") e:" + D._allEntities.length))
}, O.draw = function() {}, O);
function O() {}
var I = (H.prototype.addToPool = function(t) {
this._entities.push(t), t._active && t.setActive(!1), (t._currentObjectPool = this)._size++, t._active || this._availableCount++
}, H.prototype.removeFromPool = function(t) {
for (var i = 0; i < this._entities.length; i++) {
var e = this._entities[i];
if (t._id == e._id) {
this._entities.splice(i, 1);
break
}
}
t._currentObjectPool = null, this._size--, t._active || this._availableCount--
}, H.prototype.getAvailableEntity = function() {
for (var t = 0; t < this._entities.length; t++) {
var i = this._entities[t];
if (!i._active) return i.setActive(!0), i
}
return console.error("pool is too small for Entity with tag: " + this._entities[0].tag + "!"), null
}, H.prototype.setAllAvailable = function(t) {
for (var i = 0; i < this._entities.length; i++) {
this._entities[i].setActive(!t)
}
}, H);
function H() {
this._entities = [], this._availableCount = 0, this._size = 0
}
var j = (z.init = function(t) {
this._workerLocalStorage = t
}, z.save = function(t, i) {
this._workerLocalStorage[t] = i, postMessage([W.SaveToRealStorage, t, i])
}, z.load = function(t) {
return this._workerLocalStorage[t]
}, z);
function z() {}
var W, G, _t = (N.init = function() {
this._texturesById = {}, this._texturesByType = {}
}, N.preloadImagesFromMap = function(t) {
for (var i = 0; i < this._map._tilesets.length; i++) {
var e = this._map._tilesets[i];
e._image && r.createImage(e._image._source);
for (var s = 0; s < e._tiles.length; s++) {
var a = e._tiles[s];
a._image && r.createImage(a._image._source)
}
}
r.setOnLoadedCallback(function() {
t()
})
}, N._searchAndAddTexture = function(t, i, e) {
if (!this._texturesById[i])
for (var s = i - t._firstgid, a = 0, o = 0, n = 0; n < t._tilecount; n++) {
if (a == t._columns && (a = 0, o++), n == s) {
var r = a * t._tilewidth,
h = o * t._tileheight;
this._texturesById[i] = new m(e._source, t._tilewidth, t._tileheight, r, h);
break
}
a++
}
}, N.getTilesetForTileNumber = function(t) {
for (var i = this._map._tilesetIds.length - 1; 0 <= i; i--) {
var e = this._map._tilesetIds[i];
if (e <= t) return this._map._tilesetsByFirstId[e]
}
return null
}, N.createTextures = function() {
for (var t, i = 0; i < this._map._tileIds.length; i++) {
var e = this._map._tileIds[i],
s = this.getTilesetForTileNumber(e);
if (s) {
var a = s._image;
if (a) {
for (var o = 0; o < s._tiles.length; o++) {
if ((d = s._tiles[o])._animation)
for (var n = 0; n < (null === (t = d._animation) || void 0 === t ? void 0 : t.length); n++) {
var r = d._animation[n]._id;
this._searchAndAddTexture(s, r, a)
}
if (d._type) {
var h = d._id + s._firstgid;
this._texturesById[h] || this._searchAndAddTexture(s, h, a), this._texturesByType[d._type] || (this._texturesByType[d._type] = []);
for (var _ = !1, l = 0; l < this._texturesByType[d._type].length; l++) {
if (this._texturesByType[d._type][l] == this._texturesById[h]) {
_ = !0;
break
}
}
_ || this._texturesByType[d._type].push(this._texturesById[h])
}
}
this._texturesById[e] || this._searchAndAddTexture(s, e, a)
} else
for (var d, c = 0; c < s._tiles.length; c++) {
if (e == (d = s._tiles[c])._id + s._firstgid) {
(a = d._image) && (this._texturesById[e] = new m(a._source));
break
}
}
}
}
}, N.addSpriteFromAnimation = function(t, i) {
N._map._animationsByType[i] || console.error("Animation Name Not Found!");
for (var e = N._map._animationsByType[i], s = N._texturesById[e[0]._id], a = t.addSprite(s), o = 0; o < e.length; o++) {
var n = e[o];
a.addAnimationFrame(N._texturesById[e[o]._id], n._duration)
}
return a
}, N);
function N() {}(G = W = W || {})[G.InitWorker = 0] = "InitWorker", G[G.WorkerInitialized = 1] = "WorkerInitialized", G[G.PlaySound = 2] = "PlaySound", G[G.StopSound = 3] = "StopSound", G[G.PlayMusic = 4] = "PlayMusic", G[G.StopMusic = 5] = "StopMusic", G[G.KeyUp = 6] = "KeyUp", G[G.KeyDown = 7] = "KeyDown", G[G.TouchDown = 8] = "TouchDown", G[G.TouchMove = 9] = "TouchMove", G[G.TouchEnd = 10] = "TouchEnd", G[G.LeftThumbStickDown = 11] = "LeftThumbStickDown", G[G.LeftThumbStickX = 12] = "LeftThumbStickX", G[G.LeftThumbStickY = 13] = "LeftThumbStickY", G[G.RightThumbStickDown = 14] = "RightThumbStickDown", G[G.RightThumbStickX = 15] = "RightThumbStickX", G[G.RightThumbStickY = 16] = "RightThumbStickY", G[G.MouseDown = 17] = "MouseDown", G[G.MouseUp = 18] = "MouseUp", G[G.MouseMove = 19] = "MouseMove", G[G.GamepadConnected = 20] = "GamepadConnected", G[G.GamepadDisconnected = 21] = "GamepadDisconnected", G[G.GamepadAxis = 22] = "GamepadAxis", G[G.GamepadButton = 23] = "GamepadButton", G[G.MuteSound = 24] = "MuteSound", G[G.UnmuteSound = 25] = "UnmuteSound", G[G.MuteMusic = 26] = "MuteMusic", G[G.UnmuteMusic = 27] = "UnmuteMusic", G[G.CanvasWasScaled = 28] = "CanvasWasScaled", G[G.SaveToRealStorage = 29] = "SaveToRealStorage", onmessage = function(t) {
var i, e = t.data[0];
switch (null !== (i = lt._setup) && void 0 !== i && i.messageCallback && lt._setup.messageCallback(t), e) {
case W.InitWorker:
var s = t.data[1];
lt._canvas = s.canvas, lt._canPlaySoundAtStartup = s.canPlaySoundOnStartUp, lt._locationHref = s.locationHref, lt._tiledMap = s.tiledMap, j.init(s.vaultData), lt.entryPoint(), postMessage([W.WorkerInitialized]);
break;
case W.CanvasWasScaled:
rt._scale = t.data[1];
break;
case W.KeyUp:
case W.KeyDown:
case W.TouchDown:
case W.TouchMove:
case W.TouchEnd:
case W.MouseDown:
case W.MouseUp:
case W.MouseMove:
case W.LeftThumbStickDown:
case W.LeftThumbStickX:
case W.LeftThumbStickY:
case W.RightThumbStickDown:
case W.RightThumbStickX:
case W.RightThumbStickY:
case W.GamepadConnected:
case W.GamepadDisconnected:
case W.GamepadAxis:
case W.GamepadButton:
U.inputMessage(t.data)
}
};
var J, K, V, q, Z, Q, $, tt = function(t, i) {
this.messageCallback = null, this._start = t, this._fixedUpdate = i
},
lt = (it.preload = function(t, i) {
this._setup = t, rt.init(), r.init(), _t.init(), w.init(), U.init(), this._tiledMap ? (_t._map = this._tiledMap, _t.preloadImagesFromMap(function() {
_t.createTextures(), i()
})) : i()
}, it.init = function(t) {
it.setDefaultFont(t), D.init(), -1 < it._locationHref.indexOf("debug=true") && M.init(), nt.init(), ht.init(), C.init(it._fixedUpdate, it._draw), this._setup._start()
}, it._fixedUpdate = function() {
D.fixedUpdate(), it._setup._fixedUpdate(), M._isActive && M.fixedUpdate()
}, it._draw = function() {
D.draw(), M._isActive && M.draw()
}, it.createEntity = function(t, i, e) {
void 0 === e && (e = 0);
var s = new S(t, i);
return s._id = D._uniqueId++, s._layer = e, D._entitiesByLayers[e].push(s), D._allEntities.push(s), s
}, it.removeEntity = function(t) {
t._markedForRemoval = !0
}, it.setDefaultFont = function(t) {
this._defaultFont = t
}, it.shutDown = function() {
C.shutDown()
}, it);
function it() {}(J = {})[J.Idle = 0] = "Idle", J[J.GoingBackward = 1] = "GoingBackward", J[J.GoingForward = 2] = "GoingForward", (V = K = K || {})[V.Start = 0] = "Start", V[V.Default = 1] = "Default", V[V.Hit = 2] = "Hit", V[V.FallRecovery = 3] = "FallRecovery", V[V.Dead = 4] = "Dead", V[V.EndAcending = 5] = "EndAcending", V[V.Finished = 6] = "Finished", (Z = q = q || {})[Z.None = 0] = "None", Z[Z.Jumping = 1] = "Jumping", Z[Z.Crouching = 2] = "Crouching", Z[Z.Landing = 3] = "Landing", ($ = Q = Q || {})[$.Up = 0] = "Up", $[$.UpRight = 1] = "UpRight", $[$.Right = 2] = "Right";
var et = (st.init = function() {
var t = this;
this._maxMoveSpeed = oe._spectator ? 7 : 3, this._forwardSpeed = oe._spectator ? 0 : 2, this._sinJump = [-12, -7, -4, -2, -1, 0, 0, 0, 1, 2, 4, 7, 10], this._updateDelayOnJump = 2, this._nextSinJumpTime = 0, this._currentJumpFrame = 0, this._currentMovementSpeed = 0, this._playerState = K.Start, this._playerDefaultSubstate = q.None, this._lastVelocityX = 0, this._maxLives = oe._spectator ? 100 : 3, this._nextShotTime = nt._fixedUpdateCount + 60, this._score = 0, this._lives = this._maxLives, this._hitTimeout = 30, this._grounded = !0, this._jumpMultiplier = 1, this._nextIncrementMovementX = 0, this._canShootUp = !0, this._canShootUpRight = !0, this._canShootRight = !0, this._colliderWidth = 16, this._colliderHeight = 32, this._shootDirection = Q.Right;
for (var i = rt._centerX, e = 153, s = 0; s < _t._map._objectgroups.length; s++) {
var a = _t._map._objectgroups[s];
"Player" == a._name && (i = a._offsetx, e = a._offsety)
}
var o = lt.createEntity(i, e, Vi.Characters);
o.tag = Zi.Player, this._spriteWheelStopped = o.addSprite(_t._texturesByType.playerWheelStopped[0]), this._spriteWheelStopped.drawOffsetX = -3, this._spriteWheelStopped.drawOffsetY = 6, this._spriteWheelTurning = _t.addSpriteFromAnimation(o, "playerWheelGoing"), this._spriteWheelTurning.drawOffsetX = -3, this._spriteWheelTurning.drawOffsetY = 6, this._spriteWheelTurning.active = !1, this._spriteWheelStarting = _t.addSpriteFromAnimation(o, "playerWheelStarting"), this._spriteWheelStarting.drawOffsetX = -3, this._spriteWheelStarting.drawOffsetY = 6, this._spriteWheelStarting.repeatAnimation(!1), this._spriteWheelStarting.animationFinishedCallback = function() {
t._spriteWheelStarting.active = !1, 0 == t._rigidBody.velocityX ? (t._spriteWheelTurning.active = !1, t._spriteWheelStopped.active = !0) : (t._spriteWheelTurning.active = !0, t._spriteWheelStopped.active = !1)
}, this._spriteWheelStarting.active = !1, this._spriteWheelDirt = _t.addSpriteFromAnimation(o, "playerWheelSmoke"), this._spriteWheelDirt.drawOffsetX = -10, this._spriteWheelDirt.drawOffsetY = -1, this._spriteWheelDirt.repeatAnimation(!1), this._spriteWheelDirt.animationFinishedCallback = function() {
t._spriteWheelDirt.active = !1
}, this._spriteWheelDirt.active = !1;
var n = _t._texturesById[_t._map._animationsByType.playerDodge[0]._id];
this._spriteDodge = o.addSprite(n, 0, -14), this._spriteDodge.active = !1, this._spriteIdle = _t.addSpriteFromAnimation(o, "playerIdle"), this._spriteIdle.drawOffsetY = -14, this._spriteHit = _t.addSpriteFromAnimation(o, "playerHit"), this._spriteHit.drawOffsetY = -14, this._spriteHit.active = !1, this._spriteJump = _t.addSpriteFromAnimation(o, "playerJump"), this._spriteJump.drawOffsetY = -14, this._spriteJump.active = !1, this._spriteJump.repeatAnimation(!1), this._spriteLanding = _t.addSpriteFromAnimation(o, "playerLanding"), this._spriteLanding.drawOffsetY = -14, this._spriteLanding.active = !1, this._spriteLanding.repeatAnimation(!1), this._spriteLanding.animationFinishedCallback = function() {
t._playerDefaultSubstate = q.None, t._spriteIdle.active = !0, t._spriteDodge.active = !1, t._spriteHit.active = !1, t._spriteJump.active = !1, t._spriteLanding.active = !1
}, this._spriteDeath = _t.addSpriteFromAnimation(o, "playerDeath"), this._spriteDeath.drawOffsetY = -9, this._spriteDeath.drawOffsetX = -1, this._spriteDeath.active = !1, this._spriteDeath.repeatAnimation(!1), this._spriteDeath.animationFinishedCallback = function() {
t._spriteDeath.active = !1
}, this._gunSprite = _t.addSpriteFromAnimation(o, "playerGunAnimation"), this._gunSprite.drawOffsetX = -10, this._gunSprite.drawOffsetY = -17, this._gunSprite.repeatAnimation(!1), this._gunSprite.playAnimation(), this._gunTextureRight = _t._texturesByType.playerGunRight[0], this._gunTextureUpRight = _t._texturesByType.playerGunRightUp[0], this._gunTextureUp = _t._texturesByType.playerGunUp[0], this._spriteMuzzleFlashUp = _t.addSpriteFromAnimation(o, "playerMuzzleFlashUp"), this._spriteMuzzleFlashUp.drawOffsetX = -4, this._spriteMuzzleFlashUp.drawOffsetY = -7, this._spriteMuzzleFlashUp.repeatAnimation(!1), this._spriteMuzzleFlashUp.active = !1, this._spriteMuzzleFlashUp.animationFinishedCallback = function() {
t._spriteMuzzleFlashUp.active = !1
}, this._spriteMuzzleFlash45deg = _t.addSpriteFromAnimation(o, "playerMuzzleFlash45deg"), this._spriteMuzzleFlash45deg.drawOffsetX = 1, this._spriteMuzzleFlash45deg.drawOffsetY = -7, this._spriteMuzzleFlash45deg.repeatAnimation(!1), this._spriteMuzzleFlash45deg.active = !1, this._spriteMuzzleFlash45deg.animationFinishedCallback = function() {
t._spriteMuzzleFlash45deg.active = !1
}, this._spriteMuzzleFlashForward = _t.addSpriteFromAnimation(o, "playerMuzzleFlashForward"), this._spriteMuzzleFlashForward.drawOffsetX = 4, this._spriteMuzzleFlashForward.drawOffsetY = -1, this._spriteMuzzleFlashForward.repeatAnimation(!1), this._spriteMuzzleFlashForward.active = !1, this._spriteMuzzleFlashForward.animationFinishedCallback = function() {
t._spriteMuzzleFlashForward.active = !1
};
var r = o.addCollider(this._colliderWidth, this._colliderHeight);
r.type = k.Dynamic, r.collisionEdgeRight = !1, r.collisionEdgeLeft = !1, r.offsetX = 0, r.offsetY = -1, r.slopeOffsetLeft = -3, r.slopeOffsetRight = -8, r.safeAreaBottom = 6, o.rigidBody = new p, o.rigidBody.gravityEnabledY = !1, this._collider = r, this._player = o, this._rigidBody = o.rigidBody;
var h = j.load(oe._highScoreKey);
h || (h = "0", j.save(oe._highScoreKey, h)), this._lastHighScore = parseInt(h, 10), this._teleportDelay = -1
}, st.fixedUpdate = function() {
switch (this._checkCollisions(), this._playerState) {
case K.Start:
case K.Default:
this._processInputForMovement(), this._processInputForGun(), this._processMovement(), this._checkFallRecovery();
break;
case K.Hit:
this._processInputForMovement(), this._processMovement(), this._checkFallRecovery(), nt._fixedUpdateCount % 4 == 0 ? this._spriteHit.active = !1 : this._spriteHit.active = !0, this._hitTimeout < nt._fixedUpdateCount && (this._playerState = K.Default, this._spriteIdle.active = !0, this._spriteDodge.active = !1, this._spriteHit.active = !1, this._spriteJump.active = !1, this._spriteLanding.active = !1, 0 < this._player._sprites.length && (this._player.colorTintA = 1));
break;
case K.FallRecovery:
this._processInputForMovement(), this._processMovement(), nt._fixedUpdateCount % 4 == 0 ? this._spriteHit.active = !1 : this._spriteHit.active = !0, this._player.rigidBody && (this._player.rigidBody.velocityY = -8), this._hitTimeout < nt._fixedUpdateCount && (this._collider.collisionEdgeTop = !0, this._collider.collisionEdgeBottom = !0, 0 < this._player._sprites.length && (this._player.colorTintA = 1), this._playerState = K.Hit, this._hitTimeout = this._hitTimeout = nt._fixedUpdateCount + 50, this._triggerJump());
break;
case K.EndAcending:
this._processMovement(), this._player.x < ht._x && ht.offsetX++, this._player.x > ht._x && ht.offsetX--;
break;
case K.Finished:
-1 != this._teleportDelay && this._teleportDelay < nt._fixedUpdateCount && (this._player.colorTintA -= .1, this._player.colorTintA < 0 && (Jt.gameOver(), this._teleportDelay = -1));
break;
case K.Dead:
}
}, st._checkCollisions = function() {
if (this._player._colliderCount)
for (var t = this._collider, i = 0; i < t._hitCount; i++) {
var e, s, a, o, n, r, h, _, l, d, c, p, u, f, g, y, m, v = t._hits[i];
switch (v._entity.tag) {
case Zi.CameraMoveUp:
Ei.triggerOffsetY(Ei._currentOffsetY - 192, 0), v._entity.setActive(!1), Lt.fadeOutBuildingsBack = !0;
break;
case Zi.CameraMoveDown:
Ei.triggerOffsetY(Ei._currentOffsetY + 192, 0), v._entity.setActive(!1), Lt.fadeInBuildingsBack = !0;
break;
case Zi.TunnelUpTrigger:
Ei.triggerOffsetY(Ei._currentOffsetY - 48, 0), v._entity.setActive(!1);
break;
case Zi.TunnelDownTrigger:
Ei.triggerOffsetY(Ei._currentOffsetY + 48, 0), v._entity.setActive(!1);
break;
case Zi.End:
this._triggerEndAcension(), v._entity.setActive(!1);
break;
case Zi.EndGate:
this._playerState = K.Finished, this._rigidBody.velocityX = 0, this._rigidBody.velocityY = 0
}
this._playerState == K.Default && (e = v._entity.tag == Zi.Drone1Projectile, s = v._entity.tag == Zi.Drone2Projectile, a = v._entity.tag == Zi.Drone4Projectile, o = v._entity.tag == Zi.GroundDrone1, n = v._entity.tag == Zi.GroundDrone2, r = v._entity.tag == Zi.TurretProjectile, h = v._entity.tag == Zi.TunnelTrap1, _ = v._entity.tag == Zi.SlimeTrap1, l = v._entity.tag == Zi.FireTrap1, d = v._entity.tag == Zi.PoisonTrap1, c = v._entity.tag == Zi.FlyingDrone3, p = v._entity.tag == Zi.RailTurret1, u = v._entity.tag == Zi.RailCart1, f = v._entity.tag == Zi.RailCart2, g = v._entity.tag == Zi.GroundTurret1, y = v._entity.tag == Zi.SlimeDrip, m = v._entity.tag == Zi.FlyingDrone5, (e || o || n || r || a || _ || s || h || l || d || c || p || u || f || g || y || m) && ($i._downButtonDown && this._standUp(), 0 == this._lives ? this._killPlayer() : (this._spriteIdle.active = !1, this._spriteDodge.active = !1, this._spriteHit.active = !0, this._spriteJump.active = !1, this._spriteLanding.active = !1, this._playerState = K.Hit, this._playerDefaultSubstate = q.None, this._hitTimeout = nt._fixedUpdateCount + 70, R.playSound("assets/Audio/crash1.ogg"), this._reduceLives())))
}
}, st._processInputForMovement = function() {
var t, i;
switch ($i._upButtonDown || this._canJump || (this._canJump = !0), $i._leftButtonDown ? (1 < this._lastVelocityX && (this._spriteWheelStopped.active = !1, this._spriteWheelTurning.active = !0), this._spriteWheelStopped.active = !1, this._spriteWheelTurning.active = !0, this._nextIncrementMovementX <= nt._fixedUpdateCount && (t = this._grounded ? 3 : 2, this._nextIncrementMovementX = nt._fixedUpdateCount + t, this._currentMovementSpeed--, this._currentMovementSpeed = Math.max(this._currentMovementSpeed, -this._maxMoveSpeed)), U._leftThumbStickDown && (this._currentMovementSpeed = Math.max(-this._maxMoveSpeed, U._leftThumbStickX * this._maxMoveSpeed))) : $i._rightButtonDown && (this._lastVelocityX <= this._forwardSpeed && !this._spriteWheelStarting.active && this._startWheels(), this._nextIncrementMovementX <= nt._fixedUpdateCount && (t = this._grounded ? 6 : 4, this._nextIncrementMovementX = nt._fixedUpdateCount + t, this._currentMovementSpeed++, i = oe._spectator || this._playerState == K.Start ? 0 : 1, this._currentMovementSpeed = Math.min(this._currentMovementSpeed, this._maxMoveSpeed - i)), U._leftThumbStickDown && (this._currentMovementSpeed = Math.min(this._maxMoveSpeed, U._leftThumbStickX * this._maxMoveSpeed))), this._playerDefaultSubstate) {
case q.Landing:
case q.None:
this._playerState != K.Hit && $i._downButtonDown && this._grounded && (this._collider.set(this._colliderWidth, this._colliderHeight - 6), this._collider.offsetY = 2, this._playerDefaultSubstate = q.Crouching, this._spriteIdle.active = !1, this._spriteDodge.active = !0, this._spriteHit.active = !1, this._spriteJump.active = !1, this._spriteLanding.active = !1, this._spriteDodge.setAnimationX(4, 3, !1)), $i._upButtonDown && this._grounded && this._canJump && this._triggerJump();
break;
case q.Jumping:
break;
case q.Crouching:
$i._downButtonDown && this._grounded || this._standUp(), $i._upButtonDown && this._grounded && this._canJump && this._triggerJump()
}
}, st._processInputForGun = function() {
var t;
($i._action1ButtonDown || $i._action2ButtonDown) && this._nextShotTime < nt._fixedUpdateCount && (this._canShootUpRight && $i._action1ButtonDown && $i._action2ButtonDown ? (t = oi._playerProjectiles.getAvailableEntity()) && (t.fixedUpdate.init(this._player.x + 4, this._player.y - 9, $t.Deg45), this._shootDirection = Q.UpRight, this._gunSprite.setTexture(this._gunTextureUpRight), this._canShootUp = !1, this._canShootUpRight = !1, this._canShootRight = !1, this._nextShotTime = nt._fixedUpdateCount + 13, this._spriteMuzzleFlash45deg.active = !0, this._spriteMuzzleFlash45deg.playAnimation()) : this._canShootUp && $i._action1ButtonDown ? (t = oi._playerProjectiles.getAvailableEntity()) && (t.fixedUpdate.init(this._player.x - 4, this._player.y - 11, $t.Up), this._shootDirection = Q.Up, this._gunSprite.setTexture(this._gunTextureUp), this._canShootUp = !1, this._nextShotTime = nt._fixedUpdateCount + 13, this._spriteMuzzleFlashUp.active = !0, this._spriteMuzzleFlashUp.playAnimation()) : this._canShootRight && $i._action2ButtonDown && (t = oi._playerProjectiles.getAvailableEntity()) && (t.fixedUpdate.init(this._player.x + 3, this._player.y - 2, $t.Forward), this._shootDirection = Q.Right, this._gunSprite.setTexture(this._gunTextureRight), this._canShootRight = !1, this._nextShotTime = nt._fixedUpdateCount + 13, this._spriteMuzzleFlashForward.active = !0, this._spriteMuzzleFlashForward.playAnimation())), this._canShootUpRight || $i._action1ButtonDown && $i._action2ButtonDown || (this._canShootUpRight = !0), this._canShootUp || $i._action1ButtonDown || (this._canShootUp = !0), this._canShootRight || $i._action2ButtonDown || (this._canShootRight = !0)
}, st._processPhysics = function() {
this._playerDefaultSubstate != q.Jumping && (this._rigidBody.velocityY += 1, this._rigidBody.velocityY = Math.min(this._rigidBody.velocityY, 10))
}, st._startWheels = function() {
this._spriteWheelStopped.active = !1, this._grounded ? (this._spriteWheelTurning.active = !1, this._spriteWheelStarting.active = !0, this._spriteWheelStarting.playAnimation(), this._spriteWheelDirt.active = !0, this._spriteWheelDirt.playAnimation()) : this._spriteWheelTurning.active = !0
}, st._processMovement = function() {
switch (this._currentMovementSpeed < 0 && this._nextIncrementMovementX <= nt._fixedUpdateCount && this._grounded ? (this._nextIncrementMovementX = nt._fixedUpdateCount + 4, this._currentMovementSpeed++, 0 < this._currentMovementSpeed && (this._currentMovementSpeed = 0)) : 0 < this._currentMovementSpeed && this._nextIncrementMovementX <= nt._fixedUpdateCount && this._grounded && (this._nextIncrementMovementX = nt._fixedUpdateCount + 4, this._currentMovementSpeed--, this._currentMovementSpeed < 0 && (this._currentMovementSpeed = 0)), (this._player.x <= ht._x - rt._centerX && this._currentMovementSpeed < 0 || this._player.x >= ht._x + rt._centerX && 0 < this._currentMovementSpeed) && (this._currentMovementSpeed = 0), oe._spectator && this._playerState != K.Start || (ht.offsetX += this._currentMovementSpeed), this._rigidBody.velocityX = this._currentMovementSpeed, this._playerState != K.Start && (this._rigidBody.velocityX += this._forwardSpeed), this._rigidBody.velocityX != this._lastVelocityX && 0 == this._rigidBody.velocityX && this._playerState == K.Start && (this._spriteWheelStopped.active = !0, this._spriteWheelTurning.active = !1), this._lastVelocityX = this._rigidBody.velocityX, !this._grounded && this._collider.touchingBottom && this._playerState != K.Hit && (this._playerDefaultSubstate = q.Landing, this._spriteIdle.active = !1, this._spriteDodge.active = !1, this._spriteHit.active = !1, this._spriteJump.active = !1, this._spriteLanding.active = !0, this._spriteLanding.playAnimation()), this._playerDefaultSubstate) {
case q.None:
this._processPhysics();
break;
case q.Jumping:
this._collider.touchingTop && (this._playerDefaultSubstate = q.None), nt._fixedUpdateCount >= this._nextSinJumpTime && this._forwardJumpMovement();
break;
case q.Crouching:
case q.Landing:
this._processPhysics()
}
this._grounded = this._collider.touchingBottom
}, st._checkFallRecovery = function() {
this._player.y > ht._y + rt._height && (0 == this._lives ? this._killPlayer() : (this._playerState = K.FallRecovery, this._currentMovementSpeed = 0, this._hitTimeout = nt._fixedUpdateCount + 30, this._collider.collisionEdgeTop = !1, this._collider.collisionEdgeBottom = !1, this._spriteIdle.active = !1, this._spriteDodge.active = !1, this._spriteHit.active = !0, this._spriteJump.active = !1, this._spriteLanding.active = !1, this._currentMovementSpeed = 0, R.playSound("assets/Audio/crash1.ogg"), 0 < this._player._sprites.length && (this._player.colorTintA = .5), this._reduceLives()))
}, st._standUp = function() {
this._collider.set(this._colliderWidth, this._colliderHeight), this._collider.offsetY = -1, this._playerDefaultSubstate = q.None, this._spriteIdle.active = !0, this._spriteDodge.active = !1, this._spriteHit.active = !1, this._spriteJump.active = !1, this._spriteLanding.active = !1, this._spriteDodge.resetAnimationX()
}, st._triggerJump = function(t) {
void 0 === t && (t = 1), this._playerState != K.Hit && (this._playerDefaultSubstate = q.Jumping, this._spriteIdle.active = !1, this._spriteDodge.active = !1, this._spriteHit.active = !1, this._spriteJump.active = !0, this._spriteLanding.active = !1, this._spriteWheelDirt.active = !1, this._spriteJump.playAnimation(), R.playSound("assets/Audio/jump1.ogg")), this._currentJumpFrame = 0, this._forwardJumpMovement(), this._jumpMultiplier = t, this._canJump = !1
}, st._forwardJumpMovement = function() {
this._rigidBody.velocityY = this._sinJump[this._currentJumpFrame] * this._jumpMultiplier, this._nextSinJumpTime = nt._fixedUpdateCount + this._updateDelayOnJump, this._currentJumpFrame++, this._currentJumpFrame == this._sinJump.length && (this._playerDefaultSubstate = q.None)
}, st._reduceLives = function() {
this._lives++, Jt.setLives(this._lives)
}, st.addToLives = function() {
this._lives++, Jt.setLives(this._lives)
}, st._killPlayer = function() {
var t = this;
this._playerState = K.Dead, this._rigidBody.velocityX = 0, this._rigidBody.velocityY = 0, this._spriteIdle.active = !1, this._spriteDodge.active = !1, this._spriteHit.active = !0, this._spriteJump.active = !1, this._spriteLanding.active = !1, this._spriteHit.repeatAnimation(!1), this._spriteHit.playAnimation(), this._spriteHit.animationFinishedCallback = function() {
t._spriteHit.active = !1, t._spriteDeath.active = !0, t._spriteWheelDirt.active = !1, t._spriteWheelStopped.active = !1, t._spriteWheelStarting.active = !1, t._spriteWheelTurning.active = !1, t._spriteWheelDirt.active = !1, t._gunSprite.active = !1, t._spriteDeath.playAnimation()
}, R.playSound("assets/Audio/crash1.ogg"), Jt.gameOver()
}, st.addToScore = function(t, i, e) {
this._score += t, Jt.setScore(this._score);
var s = Jt._scoreIndicators.getAvailableEntity();
s && s.fixedUpdate.init(t.toString(), i, e)
}, st._triggerEndAcension = function() {
oe._spectator || (this._playerState = K.EndAcending, this._playerDefaultSubstate == q.Crouching && this._standUp())
}, st.triggerTeleportAway = function() {
this._player.colorTintR = 5, this._player.colorTintG = 5, this._player.colorTintB = 5, this._teleportDelay = nt._fixedUpdateCount + 5
}, st.triggerBeginRun = function() {
this._playerState = K.Default, this._startWheels()
}, st);
function st() {}
var at = (ot.prototype.fixedUpdate = function(t) {
for (var i = t._colliders[0], e = 0; e < i._hitCount; e++) {
if (i._hits[e]._entity.tag == Zi.Player) {
this._playerHitObstacle = !0;
break
}
}!this._playerHitObstacle && !this._playerHasPassedObstacle && et._player.x > t.x && (et.addToScore(this._passedItScore, t.x, t.y), this._playerHasPassedObstacle = !0)
}, ot.prototype.reset = function() {
this._playerHasPassedObstacle = !1, this._playerHitObstacle = !1
}, ot);
function ot(t) {
this._playerHitObstacle = !1, this._playerHasPassedObstacle = !1, this._passedItScore = t
}
var dt = (ct.prototype.fixedUpdate = function(t) {
this._playerPassedObstacleScript.fixedUpdate(t), t.x < ht._x - rt._centerX && this._recycle(t)
}, ct.prototype._recycle = function(t) {
this._playerPassedObstacleScript.reset(), t.setActive(!1)
}, ct);
function ct(t) {
for (var i = _t._map._animationsByType.obstacle1, e = t.addSprite(_t._texturesById[i[0]._id]), s = 0; s < i.length; s++) {
var a = i[s];
e.addAnimationFrame(_t._texturesById[a._id], a._duration)
}
this._playerPassedObstacleScript = new at(10), t.tag = Zi.SlimeTrap1, t.setActive(!1);
var o = t.addCollider(14, 17);
o.collisionEdgeTop = !1, o.collisionEdgeLeft = !1, o.collisionEdgeRight = !1, o.collisionEdgeBottom = !1, o.offsetX = -6, o.offsetY = 8, o.tagFilter = Zi.PlayerProjectile
}
var pt = (ut.prototype.reset = function() {
this._collider.offsetY = 4, this._nextAttackDelay = 7
}, ut.prototype.fixedUpdate = function(t) {
if (this._playerPassedObstacleScript.fixedUpdate(t), this._lastFrameNumber != this._sprite._currentFrameX) switch (this._lastFrameNumber = this._sprite._currentFrameX, this._sprite._currentFrameX) {
case 0:
this._collider.offsetY = 4;
break;
case 1:
this._collider.offsetY = 3;
break;
case 2:
this._collider.offsetY = 2;
break;
case 3:
this._collider.offsetY = 3;
break;
case 4:
this._collider.offsetY = 4;
break;
case 5:
this._collider.offsetY = 16;
break;
case 6:
this._collider.offsetY = 32;
break;
case 7:
this._collider.offsetY = 48, R.playSound("assets/Audio/hit1.ogg");
break;
case 8:
this._collider.offsetY = 48;
break;
case 9:
this._collider.offsetY = 45;
break;
case 10:
this._collider.offsetY = 36;
break;
case 11:
this._collider.offsetY = 9
}
t.x + this._sprite._texture._halfWidth < ht._x - rt._centerX && this._recycle(t)
}, ut.prototype._recycle = function(t) {
this._playerPassedObstacleScript.reset(), t.setActive(!1)
}, ut);
function ut(t) {
var i = _t._texturesById[_t._map._animationsByType.tunnelTrap1[0]._id];
t.tag = Zi.TunnelTrap1, t.setActive(!1), t.addSprite(i, 0, 3);
var e = t.addCollider(32, 32);
e.collisionEdgeTop = !1, e.collisionEdgeLeft = !1, e.collisionEdgeRight = !1, e.collisionEdgeBottom = !1, e.offsetY = 0, this._nextAnimationFrameTime = 0, this._playerPassedObstacleScript = new at(20), this._nextAttackDelay = 0, this._nextColliderPosition = 0, this._lastFrameNumber = 0, this._collider = t._colliders[0], this._collider.offsetX = -27, this._collider.type = k.Dynamic, this._sprite = t._sprites[0], this._sprite.setAnimationX(5, 12, !0), this.reset()
}
var ft = (gt.prototype.fixedUpdate = function(t) {
1 == this._sprite._currentFrame ? this._collider.active = !0 : 6 == this._sprite._currentFrame && (this._collider.active = !1), this._playerPassedObstacleScript.fixedUpdate(t), t.x < ht._x - rt._centerX && this._recycle(t)
}, gt.prototype._recycle = function(t) {
this._collider.active = !1, this._playerPassedObstacleScript.reset(), t.setActive(!1)
}, gt);
function gt(t) {
var i = _t._map._animationsByType.fireTrap1;
this._sprite = t.addSprite(_t._texturesById[i[0]._id]);
for (var e = 0; e < i.length; e++) {
var s = i[e];
this._sprite.addAnimationFrame(_t._texturesById[s._id], s._duration)
}
this._playerPassedObstacleScript = new at(5), t.tag = Zi.FireTrap1, t.setActive(!1);
var a = t.addCollider(11, 16);
a.collisionEdgeTop = !1, a.collisionEdgeLeft = !1, a.collisionEdgeRight = !1, a.collisionEdgeBottom = !1, a.offsetX = 1, a.offsetY = -8, a.active = !1, a.tagFilter = Zi.PlayerProjectile, this._collider = a
}
var yt = (mt.prototype.fixedUpdate = function(t) {
0 == this._sprite._currentFrame ? this._collider.active = !0 : 4 == this._sprite._currentFrame && (this._collider.active = !1), this._playerPassedObstacleScript.fixedUpdate(t), t.x < ht._x - rt._centerX && this._recycle(t)
}, mt.prototype._recycle = function(t) {
this._collider.active = !0, this._playerPassedObstacleScript.reset(), t.setActive(!1)
}, mt);
function mt(t) {
var i = _t._map._animationsByType.poisonTrap1;
this._sprite = t.addSprite(_t._texturesById[i[0]._id]);
for (var e = 0; e < i.length; e++) {
var s = i[e];
this._sprite.addAnimationFrame(_t._texturesById[s._id], s._duration)
}
this._playerPassedObstacleScript = new at(10), t.tag = Zi.PoisonTrap1, t.setActive(!1);
var a = t.addCollider(24, 18);
a.collisionEdgeTop = !1, a.collisionEdgeLeft = !1, a.collisionEdgeRight = !1, a.collisionEdgeBottom = !1, a.offsetX = 0, a.offsetY = 7, a.tagFilter = Zi.PlayerProjectile, this._collider = a
}
var vt = (xt.prototype.fixedUpdate = function(t) {
this._playerPassedObstacleScript.fixedUpdate(t);
for (var i = 0; i < this._collider._hitCount; i++) {
var e = this._collider._hits[i];
e._entity.tag != Zi.Player && e._entity.tag != Zi.PlayerProjectile || (this._mainSprite.active = !1, this._deathSprite.active = !0, this._deathSprite.playAnimation(), e._entity.tag == Zi.PlayerProjectile && et.addToScore(5, t.x, t.y), this._collider.active = !1, this._collider.reset(), R.playSound("assets/Audio/explosion1.ogg"))
}
t.x < ht._x - rt._centerX && this._recycle()
}, xt.prototype._recycle = function() {
this._playerPassedObstacleScript.reset(), this._mainSprite.active = !0, this._deathSprite.active = !1, this._collider.active = !0, this._entity.setActive(!1)
}, xt);
function xt(t) {
this._entity = t;
var i = _t._map._animationsByType.explosionTrap1Idle;
this._mainSprite = t.addSprite(_t._texturesById[i[0]._id]);
for (var e = 0; e < i.length; e++) {
var s = i[e];
this._mainSprite.addAnimationFrame(_t._texturesById[s._id], s._duration)
}
var a = _t._map._animationsByType.explosionTrap1Triggered;
this._deathSprite = t.addSprite(_t._texturesById[a[0]._id]);
for (e = 0; e < a.length; e++) {
s = a[e];
this._deathSprite.addAnimationFrame(_t._texturesById[s._id], s._duration)
}
this._deathSprite.repeatAnimation(!1), this._deathSprite.active = !1, this._deathSprite.animationFinishedCallback = this._recycle.bind(this), this._playerPassedObstacleScript = new at(10), t.tag = Zi.SlimeTrap1, t.setActive(!1);
var o = t.addCollider(16, 16);
o.collisionEdgeTop = !1, o.collisionEdgeLeft = !1, o.collisionEdgeRight = !1, o.collisionEdgeBottom = !1, o.offsetX = 0, o.offsetY = 16, this._collider = o
}
var St = (Tt.prototype.fixedUpdate = function(t) {
var i = t._colliders[0];
t.x -= 2;
for (var e = 0; e < i._hitCount; e++) {
i._hits[e]._entity.tag == Zi.Player && (this._hitPlayer = !0)
}!this._hitPlayer && !this._passedPlayer && et._player.x > t.x && (this._passedPlayer = !0, et.addToScore(30, t.x, t.y)), t.x < ht._x - rt._centerX - t._sprites[0]._texture._drawWidth && this._recycle(t)
}, Tt.prototype._recycle = function(t) {
t.setActive(!1), this._hitPlayer = !1, this._passedPlayer = !1
}, Tt);
function Tt(t) {
t.tag = Zi.TurretProjectile, t.setActive(!1);
for (var i = _t._map._animationsByType.groundTurret1Projectile, e = _t._texturesById[i[0]._id], s = t.addSprite(e), a = 0; a < i.length; a++) {
var o = i[a];
s.addAnimationFrame(_t._texturesById[o._id], o._duration)
}
var n = t.addCollider(8, 8);
n.offsetX = -20, n.offsetY = 12, n.collisionEdgeTop = !1, n.collisionEdgeLeft = !1, n.collisionEdgeRight = !1, n.collisionEdgeBottom = !1, n.type = k.Dynamic, n.tagFilter = Zi.PlayerProjectile, this._hitPlayer = !1, this._passedPlayer = !1
}
var wt = (bt.prototype.fixedUpdate = function(t) {
this._playerPassedObstacleScript.fixedUpdate(t);
var i;
t._sprites[0];
nt._fixedUpdateCount % 4 == 0 && t.x + t._aabb.x1 < ht._worldRight && --t.x, this._shot || !this._activated || (i = oi._turret1Projectile.getAvailableEntity()) && (i.x = t.x - 2, i.y = t.y - 2, this._shot = !0, R.playSound("assets/Audio/shoot2.ogg")), !this._activated && t.x < ht._x + rt._centerX && (this._activated = !0), t.x + t._aabb.x2 < ht._worldLeft && this._recycle(t)
}, bt.prototype._recycle = function(t) {
t._sprites[0].resetAnimationY(), this._activated = !1, this._shot = !1, this._playerPassedObstacleScript.reset(), t.setActive(!1)
}, bt);
function bt(t) {
t.tag = Zi.RailTurret1, t.setActive(!1);
for (var i = _t._map._animationsByType.railTurret1, e = t.addSprite(_t._texturesById[i[0]._id], 0, 0), s = 0; s < i.length; s++) {
var a = i[s];
e.addAnimationFrame(_t._texturesById[a._id], a._duration)
}
var o = t.addCollider(28, 28);
o.collisionEdgeTop = !1, o.collisionEdgeLeft = !1, o.collisionEdgeRight = !1, o.collisionEdgeBottom = !1, o.offsetX = -6, o.offsetY = 18, o.type = k.Dynamic, this._state = Di.Default, this._shot = !1, this._activated = !1, this._playerPassedObstacleScript = new at(50)
}
var Dt = (At.prototype.fixedUpdate = function(t) {
this._playerPassedObstacleScript.fixedUpdate(t), t.x + t._aabb.x1 < ht._worldRight && (t.x += -1), t.x + t._aabb.x2 < ht._worldLeft && this._recycle(t)
}, At.prototype._recycle = function(t) {
this._playerPassedObstacleScript.reset(), t.setActive(!1)
}, At);
function At(t) {
for (var i = _t._map._animationsByType.railCart1, e = t.addSprite(_t._texturesById[i[0]._id]), s = 0; s < i.length; s++) {
var a = i[s];
e.addAnimationFrame(_t._texturesById[a._id], a._duration)
}
this._playerPassedObstacleScript = new at(20), t.tag = Zi.RailCart1, t.setActive(!1);
var o = t.addCollider(36, 20);
o.collisionEdgeTop = !1, o.collisionEdgeLeft = !1, o.collisionEdgeRight = !1, o.collisionEdgeBottom = !1, o.offsetX = -2, o.offsetY = 14, o.type = k.Dynamic
}
var Pt = (Ct.prototype.fixedUpdate = function(t) {
this._playerPassedObstacleScript.fixedUpdate(t), t.x + t._aabb.x1 < ht._worldRight && (t.x += -1), t.x + t._aabb.x2 < ht._worldLeft && this._recycle(t)
}, Ct.prototype._recycle = function(t) {
this._playerPassedObstacleScript.reset(), t.setActive(!1)
}, Ct);
function Ct(t) {
for (var i = _t._map._animationsByType.railCart2, e = t.addSprite(_t._texturesById[i[0]._id]), s = 0; s < i.length; s++) {
var a = i[s];
e.addAnimationFrame(_t._texturesById[a._id], a._duration)
}
this._playerPassedObstacleScript = new at(40), t.tag = Zi.RailCart2, t.setActive(!1);
var o = t.addCollider(46, 24);
o.collisionEdgeTop = !1, o.collisionEdgeLeft = !1, o.collisionEdgeRight = !1, o.collisionEdgeBottom = !1, o.offsetX = -3, o.offsetY = 20, o.type = k.Dynamic
}
var Bt = (Ft.prototype.fixedUpdate = function(t) {
switch (this._sprite._currentFrame) {
case 0:
this._collider.active = !0, this._collider.offsetY = -30;
break;
case 3:
this._collider.offsetY = -26;
break;
case 4:
this._collider.offsetY = -24;
break;
case 5:
this._collider.offsetY = -20;
break;
case 6:
this._collider.offsetY = -13;
break;
case 7:
this._collider.offsetY = -5;
break;
case 8:
this._collider.offsetY = 5;
break;
case 9:
this._collider.offsetY = 20;
break;
case 10:
this._collider.offsetY = 46;
break;
case 13:
this._collider.active = !1
}
}, Ft);
function Ft() {
this._entity = lt.createEntity(0, 0, Vi.PropsFront), this._entity.tag = Zi.SlimeDrip, (this._entity.fixedUpdate = this)._collider = this._entity.addCollider(5, 5), this._collider.offsetX = -13, this._collider.offsetY = -30, this._collider.collisionEdgeTop = !1, this._collider.collisionEdgeLeft = !1, this._collider.collisionEdgeRight = !1, this._collider.collisionEdgeBottom = !1, this._collider.tagFilter = Zi.PlayerProjectile, this._sprite = _t.addSpriteFromAnimation(this._entity, "slimeDropperDrip")
}
var Et = (kt.prototype.fixedUpdate = function(t) {
this._playerPassedObstacleScript.fixedUpdate(t);
for (var i = 0; i < this._collider._hitCount; i++) {
var e = this._collider._hits[i];
e._entity.tag != Zi.PlayerProjectile && e._entity.tag != Zi.Player || (e._entity.tag == Zi.PlayerProjectile && et.addToScore(10, t.x, t.y), R.playSound("assets/Audio/explosion1.ogg"), this._entity.setActive(!1))
}
t.x < ht._x - rt._centerX && this._entity.setActive(!0)
}, kt);
function kt() {
this._entity = lt.createEntity(0, 0, Vi.Characters), this._entity.tag = Zi.RailStopSign, this._entity.setActive(!1), this._mainSprite = this._entity.addSprite(_t._texturesByType.railStopSign[0]), this._playerPassedObstacleScript = new at(20);
var t = this._entity.addCollider(24, 22);
t.collisionEdgeTop = !1, t.collisionEdgeLeft = !1, t.collisionEdgeRight = !1, t.collisionEdgeBottom = !1, t.offsetX = -4, t.offsetY = 4, this._collider = t, this._entity.fixedUpdate = this
}
var Ut = (Xt.prototype.fixedUpdate = function() {
0 < this._collider._hitCount && this._collider._hits[0]._entity.tag == Zi.Player && (this._collider.active = !1, this._collider.reset(), this._activeGateDelay = nt._fixedUpdateCount + 25, this._hidePlayerDelay = nt._fixedUpdateCount + 40), -1 != this._activeGateDelay && this._activeGateDelay < nt._fixedUpdateCount && (this._sprite.active = !0, this._sprite.playAnimation(), this._activeGateDelay = -1), -1 != this._hidePlayerDelay && this._hidePlayerDelay < nt._fixedUpdateCount && (et.triggerTeleportAway(), R.playSound("assets/Audio/teleport1.ogg"), this._hidePlayerDelay = -1)
}, Xt);
function Xt() {
var t = this;
this._entity = lt.createEntity(0, 0, Vi.PropsFront), this._entity.tag = Zi.EndGate, this._sprite = _t.addSpriteFromAnimation(this._entity, "endGateActive"), this._sprite.animationFinishedCallback = function() {
t._sprite.active = !1
}, this._sprite.repeatAnimation(!1), this._sprite.active = !1, this._collider = this._entity.addCollider(24, 81), this._collider.offsetX = -12, this._collider.offsetY = 23, (this._entity.fixedUpdate = this)._hidePlayerDelay = -1, this._activeGateDelay = -1
}
var Yt = (Rt.init = function() {
this._slimeTraps1 = new I, this._tunnelTraps = new I, this._groundTurrets1 = new I, this._fireTraps1 = new I, this._poisonTraps1 = new I, this._explosionTraps1 = new I, this._railTurrets1 = new I, this._railCarts1 = new I, this._railCarts2 = new I, this._slimeDropperDrip = new I;
for (var t = 0; t < 6; t++) {
(i = lt.createEntity(ht._x + rt._centerX, 0, Vi.Characters)).fixedUpdate = new dt(i), this._slimeTraps1.addToPool(i)
}
for (var i, t = 0; t < 5; t++) {
(i = lt.createEntity(ht._x + rt._centerX, 0, Vi.Characters)).fixedUpdate = new pt(i), this._tunnelTraps.addToPool(i)
}
for (t = 0; t < 10; t++) {
var e = lt.createEntity(0, 0, Vi.Characters);
e.fixedUpdate = new Pi(e), this._groundTurrets1.addToPool(e)
}
for (t = 0; t < 10; t++) {
var s = lt.createEntity(0, 0, Vi.Platforms);
s.fixedUpdate = new ft(s), this._fireTraps1.addToPool(s)
}
for (t = 0; t < 10; t++) {
var a = lt.createEntity(0, 0, Vi.Characters);
a.fixedUpdate = new yt(a), this._poisonTraps1.addToPool(a)
}
for (t = 0; t < 10; t++) {
var o = lt.createEntity(0, 0, Vi.Characters);
o.fixedUpdate = new wt(o), this._railTurrets1.addToPool(o)
}
for (t = 0; t < 10; t++) {
var n = lt.createEntity(0, 0, Vi.Characters);
n.fixedUpdate = new Dt(n), this._railCarts1.addToPool(n)
}
for (t = 0; t < 10; t++) {
var r = lt.createEntity(0, 0, Vi.Characters);
r.fixedUpdate = new Pt(r), this._railCarts2.addToPool(r)
}
for (t = 0; t < 10; t++) {
var h = lt.createEntity(0, 0, Vi.Characters);
h.fixedUpdate = new vt(h), this._explosionTraps1.addToPool(h)
}
for (t = 0; t < 10; t++) this._slimeDropperDrip.addToPool((new Bt)._entity)
}, Rt.fixedUpdate = function() {}, Rt);
function Rt() {}
var Lt = (Mt.init = function() {
var t = lt.createEntity(0, rt._centerY - 16, Vi.Sky),
i = new m("assets/backgrounds/AssetBG.png");
t.addSprite(i), t.setScale(160, 1), this._twilight = t;
var e = lt.createEntity(0, rt._centerY - 16, Vi.ParallaxFar),
s = new m("assets/backgrounds/AssetCityBG.png");
e.addSprite(s), e.parallax = new v(.5), this._buildingsFar = e;
var a = lt.createEntity(0, rt._centerY - 16, Vi.ParallaxFar),
o = new m("assets/backgrounds/Fog_Back.png");
a.addSprite(o), this._fogFar = a, this._fogFar.colorTintG = 1.5;
var n = lt.createEntity(0, rt._centerY + 76, Vi.ParallaxNear),
r = new m("assets/backgrounds/AssetBG.png", 2, 16);
r.colorTintR = .1, r.colorTintG = .1, r.colorTintB = .1, n.addSprite(r), n.setScale(160, 1), this._buildingsBackGround = n;
var h = lt.createEntity(0, rt._centerY - 16, Vi.ParallaxNear),
_ = new m("assets/backgrounds/Assetbgbuilding01.png");
h.addSprite(_);
var l = new m("assets/backgrounds/Assetbgbuilding02.png");
h.addSprite(l, 180);
var d = new m("assets/backgrounds/Assetbgbuilding03.png");
h.addSprite(d, -180, 73);
var c = new m("assets/backgrounds/Assetbgbuilding04.png");
h.addSprite(c, -360);
var p = new m("assets/backgrounds/Assetbgbuilding05.png");
h.addSprite(p, 360), h.parallax = new v(.25, 0, 16), this._buildingsBack = h;
var u = lt.createEntity(0, rt._centerY - 16, Vi.ParallaxNear),
f = new m("assets/backgrounds/Fog_front.png");
u.addSprite(f), this._fogBack = u, this._fogBack.colorTintG = 1.5;
var g = lt.createEntity(0, rt._centerY - 16, Vi.PropsBehindFade),
y = new m("assets/backgrounds/Fog_front.png");
g.addSprite(y), this._fogFront = g, this._fogFront.colorTintG = 1.5, this.fadeOutBuildingsBack = !1, this.fadeInBuildingsBack = !1, this.fadeOutFogFront = !1, this.fadeInFogFront = !1, this.fadeInFogFrontDelay = 0
}, Mt.fixedUpdate = function() {
var t = Ei._currentOffsetY + rt._centerY - 16,
i = Math.ceil(.8 * Ei._currentOffsetY) + rt._centerY - 16;
this._twilight.x = ht._x, this._twilight.y = t, this._buildingsFar.y = i, this._fogFar.x = ht._x, this._fogFar.y = t, this._buildingsBackGround.x = ht._x, this._fogBack.x = ht._x, this._fogBack.y = t, this._fogFront.x = ht._x, this._fogFront.y = t, this.fadeOutBuildingsBack && 0 < this._buildingsBack.colorTintA ? this._buildingsBack.colorTintA -= .001 : this.fadeOutBuildingsBack && (this._buildingsBack.colorTintA = 0, this.fadeOutBuildingsBack = !1), this.fadeInBuildingsBack && this._buildingsBack.colorTintA < 1 ? this._buildingsBack.colorTintA += .01 : this.fadeInBuildingsBack && (this._buildingsBack.colorTintA = 1, this.fadeInBuildingsBack = !1), this.fadeOutFogFront && 0 < this._fogFront.colorTintA ? this._fogFront.colorTintA -= .005 : this.fadeOutFogFront && (this._fogFront.colorTintA = 0, this.fadeOutFogFront = !1), this.fadeInFogFrontDelay < nt._lastUpdateTime && (this.fadeInFogFront && this._fogFront.colorTintA < 1 ? this._fogFront.colorTintA += .01 : this.fadeInFogFront && (this._fogFront.colorTintA = 1, this.fadeInFogFront = !1))
}, Mt);
function Mt() {}
var Ot = (It.prototype.fixedUpdate = function(t) {
for (var i = t._colliders[0], e = 0; e < i._hitCount; e++) {
i._hits[e]._entity.tag == Zi.HitTester && (this._isOn = !this._isOn, this._setToggle())
}
}, It.prototype._setToggle = function() {
this._sprite.setTexture(this._isOn ? this._textureOn : this._textureOff);
var t = this._isOn ? 1 : 0;
0 == t ? postMessage([W.MuteSound]) : postMessage([W.UnmuteSound]), j.save("sfx-volume", t.toString())
}, It);
function It() {
var t = lt.createEntity(rt._width - 16, 16, Vi.UIBehind);
t.ui = !0, t.tag = Zi.AudioToggle, (t.fixedUpdate = this)._textureOn = new m("assets/interface/Sound_on.png"), this._textureOff = new m("assets/interface/Sound_off.png");
var i = j.load("sfx-volume"),
e = i ? parseFloat(i) : 1;
this._isOn = 1 == e, this._changedThisUpdate = !1, this._sprite = t.addSprite(this._textureOff);
var s = t.addCollider(25, 25);
s.collisionEdgeTop = !1, s.collisionEdgeLeft = !1, s.collisionEdgeRight = !1, s.collisionEdgeBottom = !1, this._setToggle()
}
var Ht = (jt.prototype.fixedUpdate = function(t) {
for (var i = t._colliders[0], e = 0; e < i._hitCount; e++) {
i._hits[e]._entity.tag == Zi.HitTester && (this._isOn = !this._isOn, this._setToggle())
}
}, jt.prototype._setToggle = function() {
this._sprite.setTexture(this._isOn ? this._textureOn : this._textureOff);
var t = this._isOn ? 1 : 0;
0 == t ? postMessage([W.MuteMusic]) : postMessage([W.UnmuteMusic]), j.save("music-volume", t.toString())
}, jt);
function jt() {
var t = lt.createEntity(rt._width - 46, 16, Vi.UIBehind);
t.ui = !0, t.tag = Zi.AudioToggle, (t.fixedUpdate = this)._textureOn = new m("assets/interface/music.png"), this._textureOff = new m("assets/interface/music-off.png");
var i = j.load("music-volume"),
e = i ? parseFloat(i) : 1;
this._isOn = 1 == e, this._changedThisUpdate = !1, this._sprite = t.addSprite(this._textureOff);
var s = t.addCollider(25, 25);
s.collisionEdgeTop = !1, s.collisionEdgeLeft = !1, s.collisionEdgeRight = !1, s.collisionEdgeBottom = !1, this._setToggle()
}
var zt = (Wt.prototype.init = function(t, i, e) {
this._timeToDie = nt._fixedUpdateCount + 40, this._velocityY = -3, this._entity.x = i, this._entity.y = e, this._entity.setText(t, Jt._scoreFont)
}, Wt.prototype.fixedUpdate = function() {
this._entity.x += 1, this._entity.y += this._velocityY, nt._fixedUpdateCount % 4 == 0 && (this._velocityY += 1), this._timeToDie < nt._fixedUpdateCount && this._entity.setActive(!1)
}, Wt);
function Wt() {
this._entity = lt.createEntity(0, 0, Vi.Foreground), this._entity.setText("777", Jt._scoreFont), this._entity.setActive(!1), (this._entity.fixedUpdate = this)._timeToDie = 0, this._velocityY = 0, this._velocityX = 0
}
var Gt = (Nt.init = function() {
this._startDelay = oe._spectator ? 60 : 200, this._startTime = -1, this._restartDelay = nt._fixedUpdateCount + 20, this._countDownNumber = 3, this._countDownSegment = this._startDelay / 4, this._instructions = lt.createEntity(rt._centerX, rt._centerY - 45, Vi.UIBehind), this._tutorialSprite = this._instructions.addSprite(new m("assets/interface/instructions.png")), this._center = lt.createEntity(rt._centerX, rt._centerY, Vi.UIFront), this._center.tag = Zi.StartTrigger, this._center.ui = !0, this._playReplayCollider = this._center.addCollider(166, 110), this._playReplayCollider.collisionEdgeTop = !1, this._playReplayCollider.collisionEdgeLeft = !1, this._playReplayCollider.collisionEdgeRight = !1, this._playReplayCollider.collisionEdgeBottom = !1, this._replaySprite = this._center.addSprite(new m("assets/interface/replay01.png", 38, 38)), this._replaySprite.setAnimationX(8, 4), this._replaySprite.active = !1, this._countdownTextBgSprite = this._center.addSprite(new m("assets/interface/CountDown.png"), -1), this._countdownTextBgSprite.active = !1, this._countdownText = lt.createEntity(rt._centerX, rt._centerY + 2, Vi.UIFront), this._countdownText.setText(""), this._countdownText.ui = !0, this._countdownText.colorTintR = 0, this._countdownText.colorTintG = 0, this._countdownText.colorTintB = 0, R.playMusic("assets/Audio/music1.ogg")
}, Nt.fixedUpdate = function() {
for (var t = 0; t < this._playReplayCollider._hitCount; t++) {
this._playReplayCollider._hits[t]._entity.tag == Zi.HitTester && this.startButtonPressed()
}
if (this._screenshotButton)
for (t = 0; t < this._screenshotButtonCollider._hitCount; t++) {
this._screenshotButtonCollider._hits[t]._entity.tag == Zi.HitTester && postMessage([e.RequestToScreenshot])
}
if (($i._startDown && this.startButtonPressed(), -1 != this._startTime) && ((this._startTime - nt._fixedUpdateCount) % this._countDownSegment == 0 && -1 < this._countDownNumber)) {
if (0 == this._countDownNumber) return this._startTime = -1, this._countdownTextBgSprite.active = !1, this._center.setActive(!1), this._countdownText.setActive(!1), void et.triggerBeginRun();
var i = 0 == this._countDownNumber ? "" : this._countDownNumber.toString();
0 != this._countDownNumber && R.playSound("assets/Audio/beep1.ogg"), this._countdownTextBgSprite.active = !0, this._countdownText.setText(i), this._countDownNumber--
}
}, Nt.startButtonPressed = function() {
nt._fixedUpdateCount > this._restartDelay && (this._replaySprite.active ? (R.stopMusic("assets/Audio/music1.ogg"), lt.shutDown(), oe.init(Ji.Main)) : 3 == this._countDownNumber && this.startCountdown())
}, Nt.startCountdown = function() {
this._startTime = nt._fixedUpdateCount + this._startDelay, this._playReplayCollider.active = !1, this._playReplayCollider.reset()
}, Nt.activateReplayButton = function() {
this._restartDelay = nt._fixedUpdateCount + 20, this._center.setActive(!0), this._replaySprite.active = !0, this._playReplayCollider.set(50, 50), this._playReplayCollider.active = !0, this._screenshotButton && this._screenshotButton.setActive(!0)
}, Nt.enableScreenshotButtonOnGameOver = function() {
this._screenshotButton = lt.createEntity(rt._centerX, rt._centerY + 40, Vi.UIFront), this._screenshotButton.ui = !0, this._screenshotButton.tag = Zi.ScreenShotButton, this._screenshotButton.addSprite(new m("assets/interface/camera-icon.png", 32, 22)), this._screenshotButtonCollider = this._screenshotButton.addCollider(34, 24), this._screenshotButton.setActive(!1)
}, Nt);
function Nt() {}
var Jt = (Kt.init = function() {
Gt.init(), this._lives = [], this._scoreFont = new x("assets/interface/Vivaldia_numbers.png", 5, 9, -80);
var t = lt.createEntity(rt._centerX, 19, Vi.UIBehind);
t.ui = !0, t.addSprite(new m("assets/interface/Score_plate.png", 92, 38));
var i = lt.createEntity(rt._centerX, 14, Vi.UIBehind);
i.setText(""), i.ui = !0, this._scoreText = i;
var e = new m("assets/interface/star1.png"),
s = lt.createEntity(rt._centerX, 26, Vi.UIBehind);
s.colorTintG = .75, s.colorTintB = 0, s.setText(et._lastHighScore.toString(), this._scoreFont), s.ui = !0, this._highScoreText = s, this._highScoreStarLeft = s.addSprite(e, this._highScoreText._aabb.x1 - 9, -1), this._highScoreStarRight = s.addSprite(e, this._highScoreText._aabb.x2 + 8, -1);
var a = lt.createEntity(32, 14, Vi.UIBehind);
a.ui = !0, a.addSprite(new m("assets/interface/Life_status.png", 54, 22));
for (var o = new m("assets/interface/Life_status.png", 9, 8, 8, 29), n = 0; n < 3; n++) {
var r = lt.createEntity(18 + 14 * n, 14, Vi.UIBehind);
r.ui = !0, r.addSprite(o), this._lives.push(r)
}
this._scoreIndicators = new I;
for (n = 0; n < 16; n++) this._scoreIndicators.addToPool((new zt)._entity);
Kt.setScore(et._score), Kt.setLives(et._lives)
}, Kt.fixedUpdate = function() {
Gt.fixedUpdate()
}, Kt.setScore = function(t) {
this._scoreText.setText(t.toString(), this._scoreFont)
}, Kt.setLives = function(t) {
for (var i = 0; i < 3; i++) this._lives[i].setActive(i < t)
}, Kt.gameOver = function() {
Gt.activateReplayButton(), et._lastHighScore < et._score && j.save(oe._highScoreKey, et._score.toString())
}, Kt);
function Kt() {}
var Vt = (qt.prototype.fixedUpdate = function(t) {
switch (this._state) {
case Di.Default:
var i;
t.x += this.speedX, t.y += this.speedY, 0 < this._collider._hitCount && ((i = this._collider._hits[0]._entity).tag != Zi.PickupHeart && i.tag != Zi.PickupCoin && (this._state = Di.Hit, this._recycleTime = nt._fixedUpdateCount + 24, this._mainSprite.active = !1, this._hitSprite.active = !0, this._hitSprite.setAnimationX(4, 5, !1), this._collider.active = !1, this._collider.reset(), R.playSound("assets/Audio/hit1.ogg"))), (t.x > ht._x + rt._centerX || t.x < ht._x - rt._centerX || t.y > ht._y + rt._centerY || t.y < ht._y - rt._centerY) && this._destroy(t);
break;
case Di.Hit:
0 < this._recycleTime && this._recycleTime < nt._fixedUpdateCount && this._destroy(t)
}
}, qt.prototype._destroy = function(t) {
this._recycleTime = 0, this._mainSprite.resetAnimationX(), this._hitSprite.resetAnimationX(), this._collider.active = !0, this._hitSprite.active = !1, this._mainSprite.active = !0, this._state = Di.Default, t.setActive(!1)
}, qt);
function qt(t, i, e) {
void 0 === i && (i = 0), void 0 === e && (e = 4);
var s = _t._texturesById[_t._map._animationsByType.flyingDrone1MuzzleFlash[3]._id],
a = _t._texturesById[_t._map._animationsByType.drone1ProjectileHit[0]._id];
this._mainSprite = t.addSprite(s), this._hitSprite = t.addSprite(a, 0, -18), this._hitSprite.active = !1, this._collider = t.addCollider(8, 8), t.tag = Zi.Drone1Projectile, this._collider.tagFilter = Zi.FlyingDrone1, this._collider.collisionEdgeTop = !1, this._collider.collisionEdgeLeft = !1, this._collider.collisionEdgeRight = !1, this._collider.collisionEdgeBottom = !1, this._collider.type = k.Dynamic, this.speedX = i, this.speedY = e, this._recycleTime = 0, this._state = Di.Default, t.setActive(!1)
}
var Zt = (Qt.prototype.fixedUpdate = function(t) {
switch (this._state) {
case Di.Default:
t.x += this.speedX, t.y += this.speedY;
for (var i, e, s = 0, a = null, o = !1, n = 0; n < this._collider._hitCount; n++) {
var r = this._collider._hits[n],
h = r._entity;
h.tag == Zi.MapChunk && (a = r, s++), h.tag != Zi.PickupHeart && h.tag != Zi.PickupCoin && (o = !0)
}
2 != s && 1 != s || (i = null == a ? void 0 : a._entity.fixedUpdate, e = null, 1 == s ? e = oi._destroyedConcreteTiles1.getAvailableEntity() : 2 == s && (e = oi._destroyedConcreteTiles2.getAvailableEntity()), e && a && (e._sprites[0].playAnimation(), e.x = a._entity.x + a.offsetX, e.y = a._entity.y + a.offsetY, i.addToExtras(e))), o && (this._state = Di.Hit, this._recycleTime = nt._fixedUpdateCount + 24, this._mainSprite.active = !1, this._hitSprite.active = !0, this._hitSprite.setAnimationX(4, 3, !1), this._collider.active = !1, this._collider.reset(), 0 == s ? R.playSound("assets/Audio/hit1.ogg") : R.playSound("assets/Audio/explosion1.ogg")), (t.x > ht._x + rt._centerX || t.x < ht._x - rt._centerX || t.y > ht._y + rt._centerY || t.y < ht._y - rt._centerY) && this._destroy(t);
break;
case Di.Hit:
0 < this._recycleTime && this._recycleTime < nt._fixedUpdateCount && this._destroy(t)
}
}, Qt.prototype._destroy = function(t) {
this._recycleTime = 0, this._mainSprite.resetAnimationX(), this._hitSprite.resetAnimationX(), this._collider.active = !0, this._hitSprite.active = !1, this._mainSprite.active = !0, this._state = Di.Default, t.setActive(!1)
}, Qt);
function Qt(t) {
var i = _t._texturesById[_t._map._animationsByType.drone2Projectile[3]._id],
e = _t._texturesById[_t._map._animationsByType.drone2ProjectileHit[0]._id];
this._mainSprite = t.addSprite(i, 2, -13), this._hitSprite = t.addSprite(e, 0, -18), this._hitSprite.active = !1, this._collider = t.addCollider(8, 8), t.tag = Zi.Drone2Projectile, this._collider.tagFilter = Zi.FlyingDrone2, this._collider.collisionEdgeTop = !1, this._collider.collisionEdgeLeft = !1, this._collider.collisionEdgeRight = !1, this._collider.collisionEdgeBottom = !1, this._collider.type = k.Dynamic, this.speedX = 0, this.speedY = 4, this._recycleTime = 0, this._state = Di.Default;
for (var s = _t._map._animationsByType.drone2Projectile, a = 0; a < s.length; a++) {
var o = s[a];
this._mainSprite.addAnimationFrame(_t._texturesById[o._id], o._duration)
}
t.setActive(!1)
}
var $t, ti, ii = (ei.prototype.fixedUpdate = function(t) {
switch (this._state) {
case Di.Default:
var i;
t.x += this.speedX, t.y += this.speedY, 0 < this._collider._hitCount && ((i = this._collider._hits[0]._entity).tag != Zi.PickupHeart && i.tag != Zi.PickupCoin && (this._state = Di.Hit, this._recycleTime = nt._fixedUpdateCount + 24, this._mainSprite.active = !1, this._hitSprite.active = !0, this._hitSprite.setAnimationX(4, 3, !1), this._collider.active = !1, this._collider.reset(), R.playSound("assets/Audio/hit1.ogg"))), (t.x > ht._x + rt._centerX || t.x < ht._x - rt._centerX || t.y > ht._y + rt._centerY || t.y < ht._y - rt._centerY) && this._destroy(t);
break;
case Di.Hit:
0 < this._recycleTime && this._recycleTime < nt._fixedUpdateCount && this._destroy(t)
}
}, ei.prototype._destroy = function(t) {
this._recycleTime = 0, this._mainSprite.resetAnimationX(), this._hitSprite.resetAnimationX(), this._collider.active = !0, this._hitSprite.active = !1, this._mainSprite.active = !0, this._state = Di.Default, t.setActive(!1)
}, ei);
function ei(t) {
var i = _t._texturesById[_t._map._animationsByType.flyingDrone4ProjectileHit[0]._id],
e = _t._texturesById[_t._map._animationsByType.flyingDrone4ProjectileHit[0]._id];
this._mainSprite = t.addSprite(i, 35, -20), this._mainSprite.repeatAnimation(!1), this._hitSprite = t.addSprite(e, 25, -16), this._hitSprite.active = !1, this._collider = t.addCollider(8, 8), t.tag = Zi.Drone4Projectile, this._collider.tagFilter = Zi.FlyingDrone4, this._collider.collisionEdgeTop = !1, this._collider.collisionEdgeLeft = !1, this._collider.collisionEdgeRight = !1, this._collider.collisionEdgeBottom = !1, this._collider.offsetX = 8, this._collider.offsetY = 8, this._collider.type = k.Dynamic, this.speedX = -4, this.speedY = 4, this._recycleTime = 0, this._state = Di.Default, t.setActive(!1)
}(ti = $t = $t || {})[ti.Up = 0] = "Up", ti[ti.Deg45 = 1] = "Deg45", ti[ti.Deg45Reverse = 2] = "Deg45Reverse", ti[ti.Forward = 3] = "Forward";
var si = (ai.prototype.init = function(t, i, e) {
this._entity.x = t, this._entity.y = i, this._collider.active = !0, R.playSound("assets/Audio/shoot1.ogg"), this._spriteHit.active = !1, this._setDirection(e)
}, ai.prototype._setDirection = function(t) {
switch (t) {
case $t.Up:
this._spriteUp.active = !0, this._spriteDeg45.active = !1, this._spriteForward.active = !1, this.speedX = 0, this.speedY = -4;
break;
case $t.Deg45:
this._spriteUp.active = !1, this._spriteDeg45.active = !0, this._spriteForward.active = !1, this.speedX = 4, this.speedY = -4;
break;
case $t.Deg45Reverse:
this._spriteUp.active = !0, this._spriteDeg45.active = !1, this._spriteForward.active = !1, this.speedX = -4, this.speedY = -4;
break;
case $t.Forward:
this._spriteUp.active = !1, this._spriteDeg45.active = !1, this._spriteForward.active = !0, this.speedX = 4, this.speedY = 0
}
}, ai.prototype.fixedUpdate = function(t) {
if (!this._spriteHit.active) {
var i = et._playerState == K.Start ? 0 : et._forwardSpeed;
if (t.x += i + this.speedX, t.y += this.speedY, (t.x > ht._x + rt._centerX || t.y < ht._y - rt._centerY) && this._entity.setActive(!1), 0 < t._sprites.length && this._collider.active && 0 < this._collider._hitCount) {
var e = !1;
switch (this._collider._hits[0]._entity.tag) {
case Zi.Drone1Projectile:
et.addToScore(5, t.x, t.y);
break;
case Zi.Drone2Projectile:
et.addToScore(10, t.x, t.y);
break;
case Zi.Drone4Projectile:
et.addToScore(15, t.x, t.y);
break;
case Zi.GroundTurret1:
case Zi.RailCart1:
case Zi.RailCart2:
case Zi.RailTurret1:
e = !0
}
e ? (this._entity.x -= 20, this._entity.y -= 20, this._setDirection($t.Deg45Reverse), R.playSound("assets/Audio/deflect1.ogg")) : (this._collider.active = !1, this._spriteDeg45.active = !1, this._spriteUp.active = !1, this._spriteForward.active = !1, this._spriteHit.active = !0, this._spriteHit.playAnimation(), R.playSound("assets/Audio/hit1.ogg"))
}
}
}, ai);
function ai() {
var t = this;
this._entity = lt.createEntity(0, 0, Vi.Characters), this._entity.tag = Zi.PlayerProjectile, this._spriteUp = _t.addSpriteFromAnimation(this._entity, "playerProjectileUp"), this._spriteDeg45 = _t.addSpriteFromAnimation(this._entity, "playerProjectile45deg"), this._spriteForward = _t.addSpriteFromAnimation(this._entity, "playerProjectileForward"), this._spriteHit = _t.addSpriteFromAnimation(this._entity, "playerProjectileHit"), this._spriteHit.repeatAnimation(!1), this._spriteHit.animationFinishedCallback = function() {
t._entity.setActive(!1)
}, this._collider = this._entity.addCollider(6, 6), this._collider.tagFilter = Zi.Player, this._collider.collisionEdgeTop = !1, this._collider.collisionEdgeLeft = !1, this._collider.collisionEdgeRight = !1, this._collider.collisionEdgeBottom = !1, this._collider.type = k.Dynamic, this._entity.fixedUpdate = this
}
var oi = (ni.init = function() {
this._playerProjectiles = new I, this._drone1projectilesLeft = new I, this._drone1projectilesRight = new I, this._drone2projectiles = new I, this._drone4projectiles = new I, this._turret1Projectile = new I, this._destroyedConcreteTiles1 = new I, this._destroyedConcreteTiles2 = new I;
for (var t = 0; t < 10; t++) this._playerProjectiles.addToPool((new si)._entity);
for (t = 0; t < 10; t++) {
(i = lt.createEntity(0, 0, Vi.Characters)).fixedUpdate = new Vt(i, 3), this._drone1projectilesLeft.addToPool(i)
}
for (t = 0; t < 10; t++) {
(i = lt.createEntity(0, 0, Vi.Characters)).fixedUpdate = new Vt(i, -1), this._drone1projectilesRight.addToPool(i)
}
for (t = 0; t < 10; t++) {
(i = lt.createEntity(0, 0, Vi.Characters)).fixedUpdate = new Zt(i), this._drone2projectiles.addToPool(i)
}
for (t = 0; t < 10; t++) {
(i = lt.createEntity(0, 0, Vi.PropsFront)).fixedUpdate = new ii(i), this._drone4projectiles.addToPool(i)
}
for (var i, t = 0; t < 10; t++) {
(i = lt.createEntity(0, 0, Vi.Characters)).fixedUpdate = new St(i), this._turret1Projectile.addToPool(i)
}
for (t = 0; t < 12; t++) {
var e = lt.createEntity(0, 0, Vi.Platforms);
(s = _t.addSpriteFromAnimation(e, "destroyConcreteGround1")).drawOffsetX = 0, s.drawOffsetY = -16, s.repeatAnimation(!1), this._destroyedConcreteTiles1.addToPool(e)
}
for (t = 0; t < 12; t++) {
var s, a = lt.createEntity(0, 0, Vi.Platforms);
(s = _t.addSpriteFromAnimation(a, "destroyConcreteGround2")).drawOffsetX = -8, s.drawOffsetY = -24, s.repeatAnimation(!1), this._destroyedConcreteTiles2.addToPool(a)
}
}, ni.fixedUpdate = function() {}, ni);
function ni() {}
var ri = (hi.prototype.init = function(t, i) {
this._entity.x = t, this._entity.y = i, this._state = Di.Default, this._projectileLauncher.reset(), this._takesDamage.reset(), this._spawned = !1, this._entity._colliders[0].active = !1, this._mainSprite.active = !1, this._deathSprite.active = !1
}, hi.prototype.fixedUpdate = function(t) {
if (this._spawned) switch (t.x += this._speed, this._state) {
case Di.Default:
this._takesDamage.fixedUpdate(), t.x > ht._x - rt._centerX && this._projectileLauncher.fixedUpdate(t), this._takesDamage._hitPoints <= 0 && (this._state = Di.Dying, et.addToScore(20, t.x, t.y), this._projectileLauncher.cancelLaunchingProjectile = !0, this._muzzleFlash.active = !1, this._mainSprite.active = !1, this._deathSprite.active = !0, this._deathSprite.playAnimation(), R.playSound("assets/Audio/explosion1.ogg")), this._spawnedRight && this._entity.x + this._entity._aabb.x2 < ht._worldLeft && this._entity.setActive(!1), !this._spawnedRight && this._entity.x + this._entity._aabb.x1 > ht._worldRight && this._entity.setActive(!1);
break;
case Di.Dying:
} else(this._spawnedRight && this._entity.x + this._entity._aabb.x1 < ht._worldRight || !this._spawnedRight && this._entity.x + this._entity._aabb.x2 < ht._worldLeft) && (this._spawned = !0, t._sprites[0].active = !0, t._colliders[0].active = !0)
}, hi);
function hi(t) {
var i = this;
void 0 === t && (t = !1), this._entity = lt.createEntity(0, 0, Vi.Characters), this._entity.tag = Zi.FlyingDrone1;
var e = _t._map._animationsByType.flyingDrone1Idle,
s = _t._texturesById[e[0]._id];
this._mainSprite = this._entity.addSprite(s, 0, 0);
for (var a = 0; a < e.length; a++) {
var o = e[a];
_t._texturesById[o._id]._drawWidth = 32, this._mainSprite.addAnimationFrame(_t._texturesById[o._id], o._duration)
}
this._deathSprite = _t.addSpriteFromAnimation(this._entity, "flyingDrone1Death"), this._deathSprite.drawOffsetX = -5, this._deathSprite.drawOffsetY = 2, this._deathSprite.active = !1, this._deathSprite.repeatAnimation(!1), this._deathSprite.animationFinishedCallback = function() {
return i._entity.setActive(!1)
}, this._spawnedRight = t, this._state = Di.Default, this._speed = t ? -1 : 3, this._muzzleFlash = _t.addSpriteFromAnimation(this._entity, "flyingDrone1MuzzleFlash"), this._muzzleFlash.drawOffsetX = -17, this._muzzleFlash.drawOffsetY = 38, this._projectileLauncher = new wi(t ? oi._drone1projectilesRight : oi._drone1projectilesLeft, 60, "assets/Audio/shoot2.ogg", -17, 38, this._muzzleFlash, !0);
var n = this._entity.addCollider(30, 42);
n.collisionEdgeTop = !1, n.collisionEdgeLeft = !1, n.collisionEdgeRight = !1, n.collisionEdgeBottom = !1, n.offsetX = -17, n.offsetY = 10, n.type = k.Dynamic, this._takesDamage = new yi(n, 1), (this._entity.fixedUpdate = this).init(0, 0)
}
var _i = (li.prototype.init = function(t, i) {
this._entity.x = t, this._entity.y = i, this._state = Di.Default, this._takesDamage.reset(), this._projectileLauncher.reset(), this._mainSprite.active = !0, this._deathSprite.active = !1
}, li.prototype.fixedUpdate = function(t) {
switch (this._entity.x + this._entity._aabb.x1 < ht._worldRight && --this._entity.x, this._state) {
case Di.Default:
if (this._takesDamage.fixedUpdate(), t.x < ht._x + rt._centerX && this._projectileLauncher.fixedUpdate(t), this._takesDamage._hitPoints <= 0) {
this._state = Di.Dying, this._mainSprite.active = !1, this._deathSprite.active = !0, this._deathSprite.playAnimation(), et.addToScore(40, t.x, t.y), R.playSound("assets/Audio/explosion1.ogg");
break
}
this._entity.x + this._entity._aabb.x2 < ht._worldLeft && this._entity.setActive(!1);
break;
case Di.Dying:
}
}, li);
function li() {
var t = this;
this._entity = lt.createEntity(0, 0, Vi.Characters), this._entity.tag = Zi.FlyingDrone2, this._mainSprite = _t.addSpriteFromAnimation(this._entity, "flyingDrone2"), this._deathSprite = _t.addSpriteFromAnimation(this._entity, "flyingDrone2Death"), this._deathSprite.active = !1, this._deathSprite.repeatAnimation(!1), this._deathSprite.animationFinishedCallback = function() {
return t._entity.setActive(!1)
};
var i = this._entity.addCollider(30, 24);
i.collisionEdgeTop = !1, i.collisionEdgeLeft = !1, i.collisionEdgeRight = !1, i.collisionEdgeBottom = !1, i.offsetX = 0, i.offsetY = 7, i.type = k.Dynamic, this._projectileLauncher = new wi(oi._drone2projectiles, 60, "assets/Audio/shoot2.ogg", 0, 36), (this._entity.fixedUpdate = this)._takesDamage = new yi(i, 1)
}
var di = (ci.prototype.init = function(t, i) {
this._entity.x = t, this._entity.y = i, this._state = Di.Default, this._takesDamage.reset(), this._playerPassedObstacleScript.reset(), this._collider.active = !0, this._mainSprite.active = !0, this._deathSprite.active = !1
}, ci.prototype.fixedUpdate = function(t) {
switch (this._entity.x + this._entity._aabb.x1 < ht._worldRight && (this._entity.x -= 2), this._state) {
case Di.Default:
if (this._takesDamage.fixedUpdate(), this._playerPassedObstacleScript.fixedUpdate(t), this._takesDamage._hitPoints <= 0) {
this._state = Di.Dying, et.addToScore(20, t.x, t.y), this._collider.active = !1, this._collider.reset(), this._mainSprite.active = !1, this._deathSprite.active = !0, this._deathSprite.playAnimation(), R.playSound("assets/Audio/explosion1.ogg");
break
}
this._entity.x + this._entity._aabb.x2 < ht._worldLeft && this._entity.setActive(!1);
break;
case Di.Dying:
}
}, ci);
function ci() {
var t = this;
this._entity = lt.createEntity(0, 0, Vi.Characters), this._entity.tag = Zi.FlyingDrone3, this._mainSprite = _t.addSpriteFromAnimation(this._entity, "flyingDrone3"), this._mainSprite.drawOffsetY = -3, this._deathSprite = _t.addSpriteFromAnimation(this._entity, "flyingDrone3Death"), this._deathSprite.drawOffsetY = -3, this._deathSprite.active = !1, this._deathSprite.repeatAnimation(!1), this._deathSprite.animationFinishedCallback = function() {
return t._entity.setActive(!1)
}, this._playerPassedObstacleScript = new at(30), this._collider = this._entity.addCollider(36, 13), this._collider.collisionEdgeTop = !1, this._collider.collisionEdgeLeft = !1, this._collider.collisionEdgeRight = !1, this._collider.collisionEdgeBottom = !1, this._collider.offsetX = -6, this._collider.offsetY = 8, this._collider.type = k.Dynamic, this._takesDamage = new yi(this._collider, 1), (this._entity.fixedUpdate = this).init(0, 0)
}
var pi = (ui.prototype.init = function(t, i) {
this._entity.x = t, this._entity.y = i, this._state = Di.Default, this._mainSprite.active = !0, this._deathSprite.active = !1, this._takesDamage.reset(), this._directionX = -1, this._projectileLauncher.reset(), this._hasTouchLeaveCollider = !1
}, ui.prototype.fixedUpdate = function(t) {
switch (this._entity.x + this._entity._aabb.x1 < ht._worldRight && (t.x += et._forwardSpeed + this._directionX), this._state) {
case Di.Default:
if (this._takesDamage.fixedUpdate(), t.x < ht._x + rt._centerX && this._projectileLauncher.fixedUpdate(t), this._takesDamage._hitPoints <= 0) {
this._state = Di.Dying, this._mainSprite.active = !1, this._deathSprite.active = !0, this._deathSprite.playAnimation(), R.playSound("assets/Audio/explosion1.ogg"), et.addToScore(60, t.x, t.y);
break
}
for (var i = t._colliders[0], e = 0; e < i._hitCount; e++) {
i._hits[e]._entity.tag == Zi.DroneGuardLeft && (this._hasTouchLeaveCollider = !0)
}
this._hasTouchLeaveCollider ? this._directionX = -3 : t.x < ht._x ? this._directionX = 1 : t.x > ht._x + rt._centerX && (this._directionX = -1), 0 < t._sprites.length && t.x < ht._x - rt._centerX - t._sprites[0]._texture._drawWidth && this._entity.setActive(!1);
break;
case Di.Dying:
}
}, ui);
function ui() {
var t = this;
this._entity = lt.createEntity(ht._x + rt._centerX, 78, Vi.Characters), this._entity.tag = Zi.FlyingDrone4, this._state = Di.Default, this._mainSprite = _t.addSpriteFromAnimation(this._entity, "flyingDrone4");
for (var i = _t._map._animationsByType.flyingDrone4Projectile, e = _t._texturesById[i[0]._id], s = this._entity.addSprite(e, 0, 0), a = 0; a < 2; a++) {
var o = i[a];
s.addAnimationFrame(_t._texturesById[o._id], o._duration)
}
this._deathSprite = _t.addSpriteFromAnimation(this._entity, "flyingDrone4Death"), this._deathSprite.drawOffsetY = 3, this._deathSprite.active = !1, this._deathSprite.repeatAnimation(!1), this._deathSprite.animationFinishedCallback = function() {
return t._entity.setActive(!1)
};
var n = this._entity.addCollider(32, 32);
n.collisionEdgeTop = !1, n.collisionEdgeLeft = !1, n.collisionEdgeRight = !1, n.collisionEdgeBottom = !1, n.offsetX = 10, n.offsetY = -2, n.type = k.Dynamic, this._projectileLauncher = new wi(oi._drone4projectiles, 60, "assets/Audio/shoot2.ogg", -10, 16, s, !0), this._takesDamage = new yi(n, 3), (this._entity.fixedUpdate = this).init(0, 0)
}
var fi = (gi.prototype.init = function(t, i) {
this._entity.x = t, this._entity.y = i, this._state = Di.Spawning, this._takesDamage.reset(), this._mainSprite.active = !0, this._deathSprite.active = !1, this._triggeredSprite.active = !1, this._collider.tagFilter = Zi.Player, this._collider.active = !0, this._playerPassedObstacleScript.reset(), this._recycleTime = -1
}, gi.prototype.fixedUpdate = function(t) {
switch (this._playerPassedObstacleScript.fixedUpdate(this._entity), this._state) {
case Di.Spawning:
this._entity.x + this._entity._aabb.x1 < ht._worldRight && --this._entity.x, this._entity.x < ht._worldRight - this._mainSprite._texture._halfWidth && (this._mainSprite.active = !1, this._triggeredSprite.active = !0, this._triggeredSprite.playAnimation(), this._state = Di.Default);
break;
case Di.Default:
this._entity.y += 3;
for (var i = 0; i < this._collider._hitCount; i++) {
if (this._collider._hits[i]._entity.tag == Zi.MapChunk) {
this._setDying();
break
}
}
break;
case Di.Dying:
-1 != this._recycleTime && this._recycleTime < nt._lastUpdateTime && this._entity.setActive(!1)
}
}, gi.prototype._setDying = function() {
this._state = Di.Dying, this._mainSprite.active = !1, this._triggeredSprite.active = !1, this._collider.tagFilter = Zi.PlayerProjectile, this._deathSprite.active = !0, this._deathSprite.playAnimation(), R.playSound("assets/Audio/explosion1.ogg")
}, gi);
function gi() {
var t = this;
this._entity = lt.createEntity(0, 0, Vi.Characters), this._entity.tag = Zi.FlyingDrone5, (this._entity.fixedUpdate = this)._collider = this._entity.addCollider(33, 33), this._collider.offsetX = -10, this._collider.offsetY = 10, this._collider.collisionEdgeTop = !1, this._collider.collisionEdgeLeft = !1, this._collider.collisionEdgeRight = !1, this._collider.collisionEdgeBottom = !1, this._collider.type = k.Dynamic, this._mainSprite = _t.addSpriteFromAnimation(this._entity, "flyingDrone5"), this._triggeredSprite = _t.addSpriteFromAnimation(this._entity, "flyingDrone5Triggered"), this._triggeredSprite.repeatAnimation(!1), this._deathSprite = _t.addSpriteFromAnimation(this._entity, "flyingDrone5Explosion"), this._deathSprite.repeatAnimation(!1), this._deathSprite.animationFinishedCallback = function() {
t._collider.active = !1, t._recycleTime = nt._lastUpdateTime + 500
}, this._takesDamage = new yi(this._collider, 2), this._playerPassedObstacleScript = new at(50)
}
var yi = (mi.prototype.fixedUpdate = function() {
this._hitPointsLastFrame = this._hitPoints;
for (var t = 0; t < this._hitCollider._hitCount; t++) {
if (this._hitCollider._hits[t]._entity.tag == Zi.PlayerProjectile) {
this._hitPoints--;
break
}
}
}, mi.prototype.reset = function() {
this._hitPointsLastFrame = this._initalHealth, this._hitPoints = this._initalHealth
}, mi);
function mi(t, i) {
this._initalHealth = i, this._hitPoints = this._initalHealth, this._hitPointsLastFrame = this._initalHealth, this._hitCollider = t
}
var vi = (xi.prototype.init = function(t, i) {
this._entity.x = t, this._entity.y = i, this._playerPassedObstacleScript.reset(), this._state = Di.Default, this._moveX = -this._speed, this._takesDamage.reset(), this._collider.active = !0, this._rigidBody.active = !0, this._mainSprite.active = !0, this._deathSprite.active = !1, this._futureTrigger = 0
}, xi.prototype.fixedUpdate = function(t) {
switch (this._state) {
case Di.Default:
this._playerPassedObstacleScript.fixedUpdate(t), this._takesDamage.fixedUpdate(), this._takesDamage._hitPoints <= 0 ? (this._state = Di.Dying, this._futureTrigger = nt._fixedUpdateCount + 30, this._collider.active = !1, this._rigidBody.active = !1, this._mainSprite.active = !1, this._deathSprite.active = !0, this._deathSprite.playAnimation(), et.addToScore(20, t.x, t.y), R.playSound("assets/Audio/explosion1.ogg")) : this._takesDamage._hitPoints != this._takesDamage._hitPointsLastFrame && (this._state = Di.Hit, this._futureTrigger = nt._fixedUpdateCount + 10);
for (var i = 0; i < this._collider._hitCount; i++) {
var e = this._collider._hits[i];
if (e._entity.tag == Zi.DroneGuardRight) {
this._moveX = this._speed;
break
}
if (e._entity.tag == Zi.DroneGuardLeft) {
this._moveX = -this._speed;
break
}
}
t.x + this._entity._aabb.x1 < ht._worldRight && (t.x += this._moveX), t.x + this._entity._aabb.x2 < ht._worldLeft && this._entity.setActive(!1);
break;
case Di.Hit:
this._futureTrigger > nt._fixedUpdateCount && (this._state = Di.Default);
break;
case Di.Dying:
}
}, xi);
function xi() {
var t = this;
this._entity = lt.createEntity(0, 0, Vi.Characters), this._entity.tag = Zi.GroundDrone1, this._mainSprite = _t.addSpriteFromAnimation(this._entity, "groundDrone1"), this._mainSprite.drawOffsetX = 22, this._mainSprite.drawOffsetY = -16, this._deathSprite = _t.addSpriteFromAnimation(this._entity, "groundDrone1Death"), this._deathSprite.drawOffsetX = 22, this._deathSprite.drawOffsetY = -16, this._deathSprite.active = !1, this._deathSprite.repeatAnimation(!1), this._deathSprite.animationFinishedCallback = function() {
return t._entity.setActive(!1)
}, this._collider = this._entity.addCollider(17, 32), this._collider.collisionEdgeTop = !1, this._collider.collisionEdgeLeft = !1, this._collider.collisionEdgeRight = !1, this._collider.collisionEdgeBottom = !0, this._collider.type = k.Dynamic, this._entity.rigidBody = new p, this._rigidBody = this._entity.rigidBody, this._speed = 1, this._takesDamage = new yi(this._collider, 1), this._playerPassedObstacleScript = new at(30), (this._entity.fixedUpdate = this).init(0, 0)
}
var Si = (Ti.prototype.init = function(t, i) {
this._entity.x = t, this._entity.y = i, this._playerPassedObstacleScript.reset(), this._moveX = -this._speed, this._collider.active = !0, this._rigidBody.active = !0, this._futureTrigger = 0
}, Ti.prototype.fixedUpdate = function(t) {
this._playerPassedObstacleScript.fixedUpdate(t);
for (var i = 0; i < this._collider._hitCount; i++) {
var e = this._collider._hits[i];
if (e._entity.tag == Zi.DroneGuardRight) {
this._moveX = this._speed;
break
}
if (e._entity.tag == Zi.DroneGuardLeft) {
this._moveX = -this._speed;
break
}
}
t.x + this._entity._aabb.x1 < ht._worldRight && (t.x += this._moveX), t.x + this._entity._aabb.x2 < ht._worldLeft && this._entity.setActive(!1)
}, Ti);
function Ti() {
this._entity = lt.createEntity(0, 0, Vi.Characters), this._entity.tag = Zi.GroundDrone2, this._speed = 1, _t.addSpriteFromAnimation(this._entity, "groundDrone2"), this._collider = this._entity.addCollider(24, 9), this._collider.collisionEdgeTop = !1, this._collider.collisionEdgeLeft = !1, this._collider.collisionEdgeRight = !1, this._collider.collisionEdgeBottom = !0, this._collider.offsetX = -4, this._collider.offsetY = 11, this._collider.type = k.Dynamic, this._entity.rigidBody = new p, this._rigidBody = this._entity.rigidBody, this._playerPassedObstacleScript = new at(30), (this._entity.fixedUpdate = this).init(0, 0)
}
var wi = (bi.prototype.fixedUpdate = function(t) {
this._parentPositionX = t.x, this._parentPositionY = t.y, this._shotDelay < nt._fixedUpdateCount && (this._muzzleFlash && (this._muzzleFlash.active = !0, this._muzzleFlash.playAnimation()), this._shotDelay = nt._fixedUpdateCount + this._shotRepeatRate, this._spawnAfterMuzzleFlash || this._spawnProjectile())
}, bi.prototype._spawnProjectile = function() {
var t;
this.cancelLaunchingProjectile || null != (t = this._projectilePool.getAvailableEntity()) && (R.playSound(this._shotSound), t.x = this._parentPositionX + this._spawnPosX, t.y = this._parentPositionY + this._spawnPosY)
}, bi.prototype._muzzleFlashAnimationFinished = function() {
this._muzzleFlash && (this._muzzleFlash.active = !1), this._spawnAfterMuzzleFlash && this._spawnProjectile()
}, bi.prototype.reset = function() {
this.cancelLaunchingProjectile = !1, this._shotDelay = 0, this._muzzleFlash && (this._muzzleFlash.active = !1)
}, bi);
function bi(t, i, e, s, a, o, n) {
void 0 === o && (o = null), void 0 === n && (n = !1), this._projectilePool = t, this._shotRepeatRate = i, this._shotSound = e, this._spawnPosX = s, this._spawnPosY = a, this._muzzleFlash = o, this._spawnAfterMuzzleFlash = n, this._parentPositionX = 0, this._parentPositionY = 0, this._muzzleFlash && (this._muzzleFlash.active = !1, this._muzzleFlash.repeatAnimation(!1), this._muzzleFlash.animationFinishedCallback = this._muzzleFlashAnimationFinished.bind(this)), this._shotDelay = 0, this.cancelLaunchingProjectile = !1
}
var Di, Ai, Pi = (Ci.prototype.fixedUpdate = function(t) {
this._playerPassedObstacleScript.fixedUpdate(t);
var i, e = t._sprites[0];
this._shot || !this._activated || (i = oi._turret1Projectile.getAvailableEntity()) && (i.x = t.x, i.y = t.y - 4, this._shot = !0, R.playSound("assets/Audio/shoot2.ogg")), !this._activated && t.x < ht._x + rt._centerX && (this._activated = !0), t.x < ht._x - rt._centerX - e._texture._drawWidth && this._recycle(t)
}, Ci.prototype._recycle = function(t) {
t._sprites[0].resetAnimationY(), this._activated = !1, this._shot = !1, this._playerPassedObstacleScript.reset(), t.setActive(!1)
}, Ci);
function Ci(t) {
t.tag = Zi.GroundTurret1, t.setActive(!1);
for (var i = _t._map._animationsByType.groundTurret1, e = t.addSprite(_t._texturesById[i[0]._id], 0, 0), s = 0; s < i.length; s++) {
var a = i[s];
e.addAnimationFrame(_t._texturesById[a._id], a._duration)
}
var o = t.addCollider(22, 20);
o.collisionEdgeTop = !1, o.collisionEdgeLeft = !1, o.collisionEdgeRight = !1, o.collisionEdgeBottom = !1, o.offsetX = 0, o.offsetY = 14, this._state = Di.Default, this._shot = !1, this._activated = !1, this._playerPassedObstacleScript = new at(10)
}(Ai = Di = Di || {})[Ai.Spawning = 0] = "Spawning", Ai[Ai.Default = 1] = "Default", Ai[Ai.Hit = 2] = "Hit", Ai[Ai.Dying = 3] = "Dying";
var Bi = (Fi.init = function() {
this._flyingDrones1Left = new I, this._flyingDrones1Right = new I, this._flyingDrones2 = new I, this._flyingDrones3 = new I, this._flyingDrones4 = new I, this._flyingDrones5 = new I, this._groundDrones1 = new I, this._groundDrones2 = new I;
for (var t = 0; t < 10; t++) this._flyingDrones1Left.addToPool((new ri)._entity);
for (t = 0; t < 10; t++) this._flyingDrones1Right.addToPool(new ri(!0)._entity);
for (t = 0; t < 10; t++) this._flyingDrones2.addToPool((new _i)._entity);
for (t = 0; t < 10; t++) this._flyingDrones3.addToPool((new di)._entity);
for (t = 0; t < 10; t++) this._flyingDrones4.addToPool((new pi)._entity);
for (t = 0; t < 10; t++) this._flyingDrones5.addToPool((new fi)._entity);
for (t = 0; t < 10; t++) this._groundDrones1.addToPool((new vi)._entity);
for (t = 0; t < 10; t++) this._groundDrones2.addToPool((new Si)._entity)
}, Fi.fixedUpdate = function() {}, Fi);
function Fi() {}
var Ei = (ki.init = function() {
this._offsetY = 0, this._currentOffsetY = 0, this._startTransitionAtX = 0
}, ki.fixedUpdate = function() {
this._currentOffsetY != this._offsetY && this._startTransitionAtX <= ht._x && (this._currentOffsetY += this._currentOffsetY < this._offsetY ? 1 : -1), ht.set(et._player.x, rt._centerY + this._currentOffsetY - 16)
}, ki.triggerOffsetY = function(t, i) {
void 0 === i && (i = 0), this._startTransitionAtX = ht._x + i, this._offsetY = t
}, ki);
function ki() {}
var Ui = (Xi.prototype.fixedUpdate = function(t) {
if (this._transitionChunk && ht._worldLeft > t.x + t._aabb.getWidth()) t.setActive(!1);
else
for (var i = 0; i < t._colliderCount; i++) {
var e = t._colliders[i];
if (e.active && 0 < e._hitCount)
for (var s = 0; s < e._hitCount; s++) {
var a = e._hits[s];
0 < e.slope || e.slope < 0 || a._entity.tag != Zi.Drone2Projectile && a._entity.tag != Zi.FlyingDrone5 || (e.active = !1, t._sprites[i].active = !1)
}
}
}, Xi.prototype.addToExtras = function(t) {
this.extras[this._extrasCount] = t, this._extrasCount++
}, Xi.prototype.clear = function() {
for (var t = 0; t < this._extrasCount; t++) {
this.extras[t].setActive(!1)
}
this._extrasCount = 0
}, Xi);
function Xi(t) {
void 0 === t && (t = !1), this._transitionChunk = t, this.extras = [], this._extrasCount = 0
}
var Yi = (Ri.init = function() {
this._createTileObjectPools(), this._lastChunks = {}, this._currentChunks = {}, this._nextChunks = {}, this._transitionChunkTop = {}, this._transitionChunkRight = {}, this._nextJumpX = 1, this._drawOffsetY = et._player.y < 0 ? -12 : 0, 0 != this._drawOffsetY && (Lt.fadeOutBuildingsBack = !0, Ei.triggerOffsetY(16 * this._drawOffsetY));
for (var t = 0; t < _t._map._objectgroups.length; t++) {
var i = _t._map._objectgroups[t],
e = null;
switch (i._name) {
case "Backgrounds":
e = lt.createEntity(0, 0, Vi.Background);
break;
case "Foregrounds":
e = lt.createEntity(0, 0, Vi.Foreground)
}
if (e)
for (var s = 0; s < i._objects.length; s++) {
var a = i._objects[s],
o = _t._texturesById[a._gid],
n = e.addSprite(o);
n.drawOffsetX = a._x + o._halfWidth, n.drawOffsetY = a._y - o._halfHeight - 8
}
}
this.createEmptyLayers(Vi.PropsBehind), this.createEmptyLayers(Vi.Platforms), this.createEmptyLayers(Vi.PropsFront), this._nextJumpX = Math.ceil(et._player.x / rt._width), this.spawnChunkInsidePosition(et._player.x - rt._width, this._drawOffsetY, this._lastChunks), this.spawnChunkInsidePosition(et._player.x, this._drawOffsetY, this._currentChunks), this.spawnChunkInsidePosition(et._player.x + rt._width, this._drawOffsetY, this._nextChunks)
}, Ri._createTileObjectPools = function() {
this._triggerMoveUp = new I, this._triggerMoveDown = new I, this._triggerTunnelUp = new I, this._triggerTunnelDown = new I, this._droneGuardLeft = new I, this._droneGuardRight = new I, this._railStopSign = new I;
for (var t = 0; t < 3; t++) {
var i = lt.createEntity(0, -rt._centerY, 0);
i.tag = Zi.CameraMoveUp, i.setActive(!1);
var e = i.addCollider(16, 2 * rt._height);
e.tagFilter = Zi.PlayerProjectile, e.collisionEdgeTop = !1, e.collisionEdgeLeft = !1, e.collisionEdgeRight = !1, e.collisionEdgeBottom = !1, this._triggerMoveUp.addToPool(i)
}
for (t = 0; t < 3; t++) {
var s = lt.createEntity(0, -rt._centerY, 0);
s.tag = Zi.CameraMoveDown, s.setActive(!1);
var a = s.addCollider(16, 2 * rt._height);
a.tagFilter = Zi.PlayerProjectile, a.collisionEdgeTop = !1, a.collisionEdgeLeft = !1, a.collisionEdgeRight = !1, a.collisionEdgeBottom = !1, this._triggerMoveDown.addToPool(s)
}
for (t = 0; t < 4; t++) {
var o = lt.createEntity(0, -rt._centerY, 0);
o.tag = Zi.TunnelUpTrigger, o.setActive(!1);
var n = o.addCollider(16, 2 * rt._height);
n.tagFilter = Zi.PlayerProjectile, n.collisionEdgeTop = !1, n.collisionEdgeLeft = !1, n.collisionEdgeRight = !1, n.collisionEdgeBottom = !1, this._triggerTunnelUp.addToPool(o)
}
for (t = 0; t < 4; t++) {
var r = lt.createEntity(0, -rt._centerY, 0);
r.tag = Zi.TunnelDownTrigger, r.setActive(!1);
var h = r.addCollider(16, 2 * rt._height);
h.tagFilter = Zi.PlayerProjectile, h.collisionEdgeTop = !1, h.collisionEdgeLeft = !1, h.collisionEdgeRight = !1, h.collisionEdgeBottom = !1, this._triggerTunnelDown.addToPool(r)
}
for (t = 0; t < 10; t++) {
(_ = lt.createEntity(0, 0, Vi.Characters)).tag = Zi.DroneGuardLeft, _.setActive(!1), (l = _.addCollider(_t._map._tilewidth, _t._map._tileheight)).tagFilter = Zi.PlayerProjectile, l.collisionEdgeTop = !1, l.collisionEdgeLeft = !1, l.collisionEdgeRight = !1, l.collisionEdgeBottom = !1, this._droneGuardLeft.addToPool(_)
}
for (var _, l, t = 0; t < 10; t++) {
(_ = lt.createEntity(0, 0, Vi.Characters)).tag = Zi.DroneGuardRight, _.setActive(!1), (l = _.addCollider(_t._map._tilewidth, _t._map._tileheight)).tagFilter = Zi.PlayerProjectile, l.collisionEdgeTop = !1, l.collisionEdgeLeft = !1, l.collisionEdgeRight = !1, l.collisionEdgeBottom = !1, this._droneGuardRight.addToPool(_)
}
for (t = 0; t < 6; t++) this._railStopSign.addToPool((new Et)._entity)
}, Ri.fixedUpdate = function() {
var t, i, e, s = this._nextJumpX,
a = this._nextJumpX * rt._width;
ht._x > a && this._nextJumpX++, s != this._nextJumpX && (t = this._lastChunks[Vi.PropsBehind], i = this._lastChunks[Vi.Platforms], e = this._lastChunks[Vi.PropsFront], this._lastChunks[Vi.PropsBehind] = this._currentChunks[Vi.PropsBehind], this._lastChunks[Vi.Platforms] = this._currentChunks[Vi.Platforms], this._lastChunks[Vi.PropsFront] = this._currentChunks[Vi.PropsFront], this._currentChunks[Vi.PropsBehind] = this._nextChunks[Vi.PropsBehind], this._currentChunks[Vi.Platforms] = this._nextChunks[Vi.Platforms], this._currentChunks[Vi.PropsFront] = this._nextChunks[Vi.PropsFront], this._nextChunks[Vi.PropsBehind] = t, this._nextChunks[Vi.Platforms] = i, this._nextChunks[Vi.PropsFront] = e, this.spawnChunkInsidePosition(ht._x + rt._width, this._drawOffsetY, this._nextChunks))
}, Ri.createEmptyLayers = function(t) {
this._lastChunks[t] = this.createEmptyChunkEntity(t), this._currentChunks[t] = this.createEmptyChunkEntity(t), this._nextChunks[t] = this.createEmptyChunkEntity(t), this._transitionChunkTop[t] = this.createEmptyChunkEntity(t), this._transitionChunkRight[t] = this.createEmptyChunkEntity(t), this._lastChunks[t].fixedUpdate = new Ui, this._currentChunks[t].fixedUpdate = new Ui, this._nextChunks[t].fixedUpdate = new Ui, this._transitionChunkTop[t].fixedUpdate = new Ui(!0), this._transitionChunkRight[t].fixedUpdate = new Ui(!0)
}, Ri.createEmptyChunkEntity = function(t) {
var i = lt.createEntity(0, 0, t);
i.tag = Zi.MapChunk;
for (var e = _t._map, s = 0; s < 12; s++)
for (var a = 0; a < 20; a++) {
var o = i.addCollider(e._tilewidth, e._tileheight),
n = a * e._tilewidth,
r = s * e._tileheight;
o.offsetX = 8 + n, o.offsetY = r;
for (var h = _t._texturesById[2], _ = i.addSprite(h, n, r), l = 0; l < 10; l++) _.addAnimationFrame(h, 100);
_.clearAnimation()
}
return i.setActive(!1), i
}, Ri._createChunk = function(t, i, e) {
var s = e[i],
a = s.fixedUpdate,
o = _t._map,
n = _t._texturesById,
r = _t._map._animationsById,
h = _t._map._tileTypes,
_ = t._tileNumbers,
l = t._x,
d = t._y,
c = t._width,
p = (t._height, l * o._tilewidth),
u = d * o._tileheight;
s.setActive(!0), s.x = p, s.y = u, a.clear();
for (var f = -1, g = 0, y = 0; y < _.length; y++) {
++f == c && (f = 0, g++);
var m = _[y],
v = s._colliders[y],
x = s._sprites[y],
S = n[m],
T = h[m];
if (x.clearAnimation(), x.active = !1, v.reset(), v.active = !1, S) {
var w = f * o._tilewidth + S._halfWidth,
b = g * o._tileheight - S._halfHeight + .5 * o._tileheight;
if (T) switch (v.slope = 0, v.slopeNumber = 0, v.tagFilter = -1, T) {
case "collider":
v.active = !0, v.collisionEdgeTop = !0, v.collisionEdgeLeft = !1, v.collisionEdgeRight = !1, v.collisionEdgeBottom = !0;
break;
case "hiddenCollider":
v.active = !0, v.collisionEdgeTop = !0, v.collisionEdgeLeft = !1, v.collisionEdgeRight = !1, v.collisionEdgeBottom = !0;
continue;
case "slopeUp1":
case "slopeUp1Hidden":
if (v.slope = 1, v.active = !0, v.tagFilter = Zi.PlayerProjectile, v.collisionEdgeLeft = !0, v.collisionEdgeRight = !0, v.collisionEdgeTop = !0, v.collisionEdgeBottom = !0, "slopeUp1Hidden" == T) continue;
x.active = !0;
break;
case "slopeDown1":
case "slopeDown1Hidden":
if (v.slope = -1, v.active = !0, v.tagFilter = Zi.PlayerProjectile, v.collisionEdgeLeft = !0, v.collisionEdgeRight = !0, v.collisionEdgeTop = !0, v.collisionEdgeBottom = !0, "slopeDown1Hidden" == T) continue;
x.active = !0;
break;
case "slopeUp2-1":
v.slope = 2, v.slopeNumber = 0, v.active = !0, v.tagFilter = Zi.PlayerProjectile, v.collisionEdgeLeft = !0, v.collisionEdgeRight = !0, v.collisionEdgeTop = !0, v.collisionEdgeBottom = !0;
break;
case "slopeUp2-2":
v.slope = 2, v.slopeNumber = 1, v.active = !0, v.tagFilter = Zi.PlayerProjectile, v.collisionEdgeLeft = !0, v.collisionEdgeRight = !0, v.collisionEdgeTop = !0, v.collisionEdgeBottom = !0;
break;
case "slopeDown2-1":
v.slope = -2, v.slopeNumber = 1, v.active = !0, v.tagFilter = Zi.PlayerProjectile, v.collisionEdgeLeft = !0, v.collisionEdgeRight = !0, v.collisionEdgeTop = !0, v.collisionEdgeBottom = !0;
break;
case "slopeDown2-2":
v.slope = -2, v.slopeNumber = 0, v.active = !0, v.tagFilter = Zi.PlayerProjectile, v.collisionEdgeLeft = !0, v.collisionEdgeRight = !0, v.collisionEdgeTop = !0, v.collisionEdgeBottom = !0;
break;
case "slopeUp3-1":
v.slope = 3, v.slopeNumber = 0, v.active = !0, v.tagFilter = Zi.PlayerProjectile, v.collisionEdgeLeft = !0, v.collisionEdgeRight = !0, v.collisionEdgeTop = !0, v.collisionEdgeBottom = !0;
continue;
case "slopeUp3-2":
v.slope = 3, v.slopeNumber = 1, v.active = !0, v.tagFilter = Zi.PlayerProjectile, v.collisionEdgeLeft = !0, v.collisionEdgeRight = !0, v.collisionEdgeTop = !0, v.collisionEdgeBottom = !0;
continue;
case "slopeUp3-3":
v.slope = 3, v.slopeNumber = 2, v.active = !0, v.tagFilter = Zi.PlayerProjectile, v.collisionEdgeLeft = !0, v.collisionEdgeRight = !0, v.collisionEdgeTop = !0, v.collisionEdgeBottom = !0;
continue;
case "slopeDown3-1":
v.slope = -3, v.slopeNumber = 2, v.active = !0, v.tagFilter = Zi.PlayerProjectile, v.collisionEdgeLeft = !0, v.collisionEdgeRight = !0, v.collisionEdgeTop = !0, v.collisionEdgeBottom = !0;
continue;
case "slopeDown3-2":
v.slope = -3, v.slopeNumber = 1, v.active = !0, v.tagFilter = Zi.PlayerProjectile, v.collisionEdgeLeft = !0, v.collisionEdgeRight = !0, v.collisionEdgeTop = !0, v.collisionEdgeBottom = !0;
continue;
case "slopeDown3-3":
v.slope = -3, v.slopeNumber = 0, v.active = !0, v.tagFilter = Zi.PlayerProjectile, v.collisionEdgeLeft = !0, v.collisionEdgeRight = !0, v.collisionEdgeTop = !0, v.collisionEdgeBottom = !0;
continue;
case "chunkMarker":
continue;
case "tunnelEnter":
Lt.fadeOutFogFront = !0;
break;
case "tunnelExit":
Lt.fadeInFogFrontDelay = nt._lastUpdateTime + 4200, Lt.fadeInFogFront = !0;
break;
case "flyingDrone1SpawnLeft":
var D = Bi._flyingDrones1Left.getAvailableEntity();
D && D.fixedUpdate.init(s.x + w, s.y + b);
continue;
case "flyingDrone1SpawnRight":
var A = Bi._flyingDrones1Right.getAvailableEntity();
A && A.fixedUpdate.init(s.x + w, s.y + b);
continue;
case "flyingDrone2":
var P = Bi._flyingDrones2.getAvailableEntity();
P && P.fixedUpdate.init(s.x + w, s.y + b);
continue;
case "flyingDrone3":
var C = Bi._flyingDrones3.getAvailableEntity();
C && C.fixedUpdate.init(s.x + w, s.y + b);
continue;
case "flyingDrone4":
var B = Bi._flyingDrones4.getAvailableEntity();
B && B.fixedUpdate.init(s.x + w, s.y + b);
continue;
case "flyingDrone5":
var F = Bi._flyingDrones5.getAvailableEntity();
F && F.fixedUpdate.init(s.x + w, s.y + b);
continue;
case "groundDrone1":
var E = Bi._groundDrones1.getAvailableEntity();
E && E.fixedUpdate.init(s.x + w, s.y + b - 20);
continue;
case "groundDrone2":
var k = Bi._groundDrones2.getAvailableEntity();
k && k.fixedUpdate.init(s.x + w, s.y + b);
continue;
case "cameraUp":
this.spawnChunkInsidePosition(ht._x + 2 * rt._width, this._drawOffsetY, this._transitionChunkRight), this._drawOffsetY = -12, this.spawnChunkInsidePosition(ht._x + rt._width, this._drawOffsetY, this._transitionChunkTop);
var U = this._triggerMoveUp.getAvailableEntity();
U && (U.x = s.x + w, U.y = s.y + b - rt._centerY);
continue;
case "cameraDown":
this.spawnChunkInsidePosition(ht._x + 2 * rt._width, this._drawOffsetY, this._transitionChunkRight), this._drawOffsetY = 0, this.spawnChunkInsidePosition(ht._x + rt._width, this._drawOffsetY, this._transitionChunkTop);
var X = this._triggerMoveDown.getAvailableEntity();
X && (X.x = s.x + w, X.y = s.y + b);
continue;
case "tunnelUp":
this._drawOffsetY = -12;
var Y = this._triggerTunnelUp.getAvailableEntity();
Y && (Y.x = s.x + w, Y.y = s.y + b);
continue;
case "tunnelDown":
var R = this._triggerTunnelDown.getAvailableEntity();
R && (R.x = s.x + w, R.y = s.y + b);
continue;
case "railStopSign":
var L = this._railStopSign.getAvailableEntity();
L && (L.x = s.x + w, L.y = s.y + b);
continue;
case "stopLeft":
var M = this._droneGuardLeft.getAvailableEntity();
M && (M.x = s.x + w, M.y = s.y + b, a.addToExtras(M));
continue;
case "stopRight":
var O = this._droneGuardRight.getAvailableEntity();
O && (O.x = s.x + w, O.y = s.y + b, a.addToExtras(O));
continue;
case "tunnelTrap1":
var I = Yt._tunnelTraps.getAvailableEntity();
I && (I.x = s.x + w, I.y = s.y + b);
continue;
case "obstacle1":
var H = Yt._slimeTraps1.getAvailableEntity();
H && (H.x = s.x + w, H.y = s.y + b);
continue;
case "groundTurret1":
var j = Yt._groundTurrets1.getAvailableEntity();
j && (j.x = s.x + w, j.y = s.y + b);
continue;
case "explosionTrap1Idle":
var z = Yt._explosionTraps1.getAvailableEntity();
z && (z.x = s.x + w, z.y = s.y + b);
continue;
case "fireTrap1":
var W = Yt._fireTraps1.getAvailableEntity();
W && (W.x = s.x + w, W.y = s.y + b);
continue;
case "poisonTrap1":
var G = Yt._poisonTraps1.getAvailableEntity();
G && (G.x = s.x + w, G.y = s.y + b);
continue;
case "railTurret1":
var N = Yt._railTurrets1.getAvailableEntity();
N && (N.x = s.x + w, N.y = s.y + b);
continue;
case "railCart1":
var J = Yt._railCarts1.getAvailableEntity();
J && (J.x = s.x + w, J.y = s.y + b);
continue;
case "railCart2":
var K = Yt._railCarts2.getAvailableEntity();
K && (K.x = s.x + w, K.y = s.y + b);
continue;
case "slimeDropperDrip":
var V = Yt._slimeDropperDrip.getAvailableEntity();
V && (V.x = s.x + w, V.y = s.y + b);
continue;
case "endTrigger":
var q = lt.createEntity(s.x + w, s.y + b - rt._centerY, Vi.Platforms);
q.tag = Zi.End;
var Z = q.addCollider(16, 2 * rt._height);
Z.tagFilter = Zi.PlayerProjectile, Z.collisionEdgeTop = !1, Z.collisionEdgeLeft = !1, Z.collisionEdgeRight = !1, Z.collisionEdgeBottom = !1;
continue;
case "pickupHeart":
var Q = Hi._hearts.getAvailableEntity();
Q && (Q.x = s.x + w, Q.y = s.y + b);
continue;
case "pickupCoin1":
var $ = Hi._coins.getAvailableEntity();
$ && ($.x = s.x + w, $.y = s.y + b);
continue;
case "stop":
var tt = lt.createEntity(s.x + w, s.y + b, Vi.Platforms);
tt.tag = Zi.Stop;
var it = tt.addCollider(16, rt._centerY);
it.tagFilter = Zi.PlayerProjectile, it.collisionEdgeTop = !1, it.collisionEdgeLeft = !1, it.collisionEdgeRight = !1, it.collisionEdgeBottom = !1;
continue;
case "endGateIdle":
var et = new Ut;
et._entity.x = s.x + w, et._entity.y = s.y + b
}
var st = r[m];
if (x.active = !0, x.setTexture(S), x.drawOffsetX = w, x.drawOffsetY = b, st)
for (var at = 0; at < st.length; at++) {
var ot = st[at];
n[ot._id] && x.addAnimationFrame(n[ot._id], ot._duration)
}
}
}
}, Ri.spawnChunkInsidePosition = function(t, i, e) {
for (var s = _t._map, a = 0; a < s._layers.length; a++)
for (var o = s._layers[a], n = 0; n < o._chunks.length; n++) {
var r = o._chunks[n],
h = r._x * Math.floor(s._tilewidth),
_ = r._y * Math.floor(s._tileheight),
l = (r._x + r._width) * s._tilewidth,
d = (r._y + r._height) * s._tileheight;
if (h <= t && t < l && _ <= i && i < d) switch (o._name) {
case "Props Behind":
this._createChunk(r, Vi.PropsBehind, e);
break;
case "Platforming":
this._createChunk(r, Vi.Platforms, e);
break;
case "Props Front":
this._createChunk(r, Vi.PropsFront, e)
}
}
}, Ri);
function Ri() {}
var Li = (Mi.prototype.fixedUpdate = function(t) {
for (var i = t._colliders[0], e = 0; e < i._hitCount; e++) {
if (i._hits[e]._entity.tag == Zi.Player) {
R.playSound("assets/Audio/powerup1.ogg"), et._lives < et._maxLives ? et.addToLives() : et.addToScore(50, t.x, t.y), t.setActive(!1);
break
}
}
t.x < ht._x - rt._centerX - t._sprites[0]._texture._drawWidth && t.setActive(!1)
}, Mi);
function Mi() {
this._entity = lt.createEntity(0, 0, Vi.Platforms), (this._entity.fixedUpdate = this)._entity.tag = Zi.PickupHeart, _t.addSpriteFromAnimation(this._entity, "pickupHeart");
var t = this._entity.addCollider(12, 12);
t.tagFilter = Zi.PlayerProjectile, t.offsetX = -1, t.offsetY = 1, t.collisionEdgeTop = !1, t.collisionEdgeLeft = !1, t.collisionEdgeRight = !1, t.collisionEdgeBottom = !1
}
var Oi = (Ii.prototype.fixedUpdate = function(t) {
for (var i = t._colliders[0], e = 0; e < i._hitCount; e++) {
if (i._hits[e]._entity.tag == Zi.Player) {
R.playSound("assets/Audio/coin1.ogg"), et.addToScore(5, this._entity.x, this._entity.y), t.setActive(!1);
break
}
}
t.x < ht._x - rt._centerX - t._sprites[0]._texture._drawWidth && t.setActive(!1)
}, Ii);
function Ii() {
this._entity = lt.createEntity(0, 0, Vi.Platforms), (this._entity.fixedUpdate = this)._entity.tag = Zi.PickupCoin, _t.addSpriteFromAnimation(this._entity, "pickupCoin1");
var t = this._entity.addCollider(12, 12);
t.offsetX = -1, t.offsetY = 1, t.tagFilter = Zi.PlayerProjectile, t.collisionEdgeTop = !1, t.collisionEdgeLeft = !1, t.collisionEdgeRight = !1, t.collisionEdgeBottom = !1
}
var Hi = (ji.init = function() {
this._hearts = new I, this._coins = new I;
for (var t = 0; t < 6; t++) this._hearts.addToPool((new Li)._entity);
for (t = 0; t < 100; t++) this._coins.addToPool((new Oi)._entity)
}, ji.fixedUpdate = function() {}, ji);
function ji() {}
var zi = (Wi.init = function() {
this._playerPushedButton = !1;
var t = lt.createEntity(0, 0, Vi.UIBehind);
t.tag = Zi.HitTester, t.setActive(!1);
var i = t.addCollider(2, 2);
i.collisionEdgeTop = !1, i.collisionEdgeLeft = !1, i.collisionEdgeRight = !1, i.collisionEdgeBottom = !1, i.type = k.Dynamic, t.ui = !0, this._hitTester = t
}, Wi.fixedUpdate = function() {
!$i.showMobileControlsOnLoad && U._touchDown && ($i.showMobileControlsOnLoad = !0), !U._mouseButtonDown[0] && !U._touchDown || this._hitTester._active || this._playerPushedButton ? this._hitTester._active ? this._hitTester.setActive(!1) : U._mouseButtonDown[0] || U._touchDown || !this._playerPushedButton || (this._playerPushedButton = !1) : (this._hitTester.setActive(!0), this._hitTester.x = U._mousePositionX / rt._scale, this._hitTester.y = U._mousePositionY / rt._scale, this._playerPushedButton = !0)
}, Wi);
function Wi() {}
var Gi = (Ni.init = function() {
new Ht, new Ot
}, Ni.fixedUpdate = function() {}, Ni);
function Ni() {}
var Ji, Ki, Vi, qi, Zi, Qi, $i = (te.init = function() {
this._touchControlsHidden = !0, this.showMobileControlsOnLoad = !1, this._upButtonDown = !1, this._downButtonDown = !1, this._leftButtonDown = !1, this._rightButtonDown = !1, this._action1ButtonDown = !1, this._action2ButtonDown = !1, this._stick1Down = !1, this._stick2Down = !1, this._startDown = !1, this._upButtonPressed = !1, this._downButtonPressed = !1, this._leftButtonPressed = !1, this._rightButtonPressed = !1, this._action1ButtonPressed = !1, this._action2ButtonPressed = !1, this._stick1Pressed = !1, this._stick2Pressed = !1, this._startPressed = !1
}, te.fixedUpdate = function() {
this._upButtonPressed = !1, this._downButtonPressed = !1, this._leftButtonPressed = !1, this._rightButtonPressed = !1, this._action1ButtonPressed = !1, this._action2ButtonPressed = !1;
var t = this._startPressed = !1,
i = !1,
e = !1,
s = !1,
a = !1,
o = !1,
n = !1;
if (0 < U._gamepadsCount)
for (var r in U._gamepads) {
var h = U._gamepads[r],
_ = h.axis[0];
_ && (.5 < _ ? s = !0 : _ < -.5 && (e = !0));
var l = h.axis[1];
l && .5 < l && (i = !0), h.buttons[0] && (t = !0), (h.buttons[3] || h.buttons[2]) && (a = !0), (h.buttons[1] || h.buttons[2]) && (o = !0), h.buttons[9] && (n = !0)
}
U._keyDown.KeyW || U._keyDown.ArrowUp || t ? this._upButtonDown || (this._upButtonPressed = !0, this._upButtonDown = !0) : this._upButtonDown && (this._upButtonDown = !1), U._keyDown.KeyS || U._keyDown.ArrowDown || i ? this._downButtonDown || (this._downButtonPressed = !0, this._downButtonDown = !0) : this._downButtonDown && (this._downButtonDown = !1), U._keyDown.KeyA || U._keyDown.ArrowLeft || e ? this._leftButtonDown || (this._leftButtonPressed = !0, this._leftButtonDown = !0) : this._leftButtonDown && (this._leftButtonDown = !1), U._keyDown.KeyD || U._keyDown.ArrowRight || s ? this._rightButtonDown || (this._rightButtonPressed = !0, this._rightButtonDown = !0) : this._rightButtonDown && (this._rightButtonDown = !1), U._keyDown.KeyN || a ? this._action1ButtonDown || (this._action1ButtonPressed = !0, this._action1ButtonDown = !0) : this._action1ButtonDown && (this._action1ButtonDown = !1), U._keyDown.KeyM || o ? this._action2ButtonDown || (this._action2ButtonPressed = !0, this._action2ButtonDown = !0) : this._action2ButtonDown && (this._action2ButtonDown = !1), U._keyDown.Space || U._keyDown.Enter || n ? this._startDown || (this._startPressed = !0, this._startDown = !0) : this._startDown && (this._startDown = !1)
}, te);
function te() {}(Ki = Ji = Ji || {})[Ki.ClickToPlay = 0] = "ClickToPlay", Ki[Ki.Intro = 1] = "Intro", Ki[Ki.Main = 2] = "Main", (qi = Vi = Vi || {})[qi.Sky = 0] = "Sky", qi[qi.ParallaxFar = 1] = "ParallaxFar", qi[qi.ParallaxNear = 2] = "ParallaxNear", qi[qi.Background = 3] = "Background", qi[qi.PropsBehind = 4] = "PropsBehind", qi[qi.PropsBehindFade = 5] = "PropsBehindFade", qi[qi.Platforms = 6] = "Platforms", qi[qi.UIBehind = 7] = "UIBehind", qi[qi.Characters = 8] = "Characters", qi[qi.PropsFront = 9] = "PropsFront", qi[qi.Foreground = 10] = "Foreground", qi[qi.UIFront = 11] = "UIFront", (Qi = Zi = Zi || {})[Qi.Player = 0] = "Player", Qi[Qi.StartTrigger = 1] = "StartTrigger", Qi[Qi.PickupHeart = 2] = "PickupHeart", Qi[Qi.PickupCoin = 3] = "PickupCoin", Qi[Qi.PlayerProjectile = 4] = "PlayerProjectile", Qi[Qi.Drone1Projectile = 5] = "Drone1Projectile", Qi[Qi.Drone2Projectile = 6] = "Drone2Projectile", Qi[Qi.Drone4Projectile = 7] = "Drone4Projectile", Qi[Qi.FlyingDrone1 = 8] = "FlyingDrone1", Qi[Qi.FlyingDrone2 = 9] = "FlyingDrone2", Qi[Qi.FlyingDrone3 = 10] = "FlyingDrone3", Qi[Qi.FlyingDrone4 = 11] = "FlyingDrone4", Qi[Qi.FlyingDrone5 = 12] = "FlyingDrone5", Qi[Qi.TunnelTrap1 = 13] = "TunnelTrap1", Qi[Qi.TurretProjectile = 14] = "TurretProjectile", Qi[Qi.SlimeDrip = 15] = "SlimeDrip", Qi[Qi.GroundDrone1 = 16] = "GroundDrone1", Qi[Qi.GroundDrone2 = 17] = "GroundDrone2", Qi[Qi.DroneGuardLeft = 18] = "DroneGuardLeft", Qi[Qi.DroneGuardRight = 19] = "DroneGuardRight", Qi[Qi.GroundTurret1 = 20] = "GroundTurret1", Qi[Qi.HitTester = 21] = "HitTester", Qi[Qi.RailTurret1 = 22] = "RailTurret1", Qi[Qi.RailCart1 = 23] = "RailCart1", Qi[Qi.RailCart2 = 24] = "RailCart2", Qi[Qi.FireTrap1 = 25] = "FireTrap1", Qi[Qi.PoisonTrap1 = 26] = "PoisonTrap1", Qi[Qi.ExplosionTrap1 = 27] = "ExplosionTrap1", Qi[Qi.AudioToggle = 28] = "AudioToggle", Qi[Qi.CameraMoveUp = 29] = "CameraMoveUp", Qi[Qi.CameraMoveDown = 30] = "CameraMoveDown", Qi[Qi.TunnelUpTrigger = 31] = "TunnelUpTrigger", Qi[Qi.TunnelDownTrigger = 32] = "TunnelDownTrigger", Qi[Qi.SlimeTrap1 = 33] = "SlimeTrap1", Qi[Qi.MapChunk = 34] = "MapChunk", Qi[Qi.RailStopSign = 35] = "RailStopSign", Qi[Qi.ScreenShotButton = 36] = "ScreenShotButton", Qi[Qi.End = 37] = "End", Qi[Qi.Stop = 38] = "Stop", Qi[Qi.EndGate = 39] = "EndGate";
var ie = (ee.prototype.fixedUpdate = function(t) {
if ($i._startDown) this._startGameWithSound();
else
for (var i = 0; this._collider._hitCount; i++) {
if (this._collider._hits[i]._entity.tag == Zi.HitTester) {
this._startGameWithSound();
break
}
}
}, ee.prototype._startGameWithSound = function() {
lt.shutDown(), oe.init(oe._skipIntro ? Ji.Main : Ji.Intro)
}, ee);
function ee() {
this._clickToPlayBg = lt.createEntity(rt._centerX, rt._centerY, Vi.UIBehind), this._clickToPlayBg.ui = !0;
var t = new m("assets/interface/ClickToPlay.png");
this._clickToPlayBg.addSprite(t), (this._clickToPlayBg.fixedUpdate = this)._collider = this._clickToPlayBg.addCollider(rt._width, rt._height), this._clickToPlayText = lt.createEntity(rt._centerX, rt._centerY + 2, Vi.UIBehind), this._clickToPlayText.ui = !0, this._clickToPlayText.colorTintR = 0, this._clickToPlayText.colorTintG = 0, this._clickToPlayText.colorTintB = 0, this._clickToPlayText.setText("CLICK TO PLAY!")
}
var se = (ae.prototype.fixedUpdate = function(t) {
if (this._canSkipIntro) {
$i._startDown && this._startMainScene();
for (var i = 0; i < this._skipCollider._hitCount; i++) {
this._skipCollider._hits[i]._entity.tag == Zi.HitTester && this._startMainScene()
}
}
}, ae.prototype._startMainScene = function() {
for (var t = 0; t < this._timeOuts.length; t++) clearTimeout(this._timeOuts[t]);
lt.shutDown(), oe.init(Ji.Main)
}, ae);
function ae() {
var t = this;
this._canSkipIntro = !1, this._timeOuts = [], this._entity = lt.createEntity(0, 0, 0), (this._entity.fixedUpdate = this)._skipEntity = lt.createEntity(rt._centerX, rt._centerY, Vi.UIFront), this._skipEntity.ui = !0, this._skipCollider = this._skipEntity.addCollider(300, 120), this._tonyAnimationSin = [-10, -2, 2, 10, 5, 2, -2, -10];
var i = new m("assets/intro/panel-top.png"),
e = new m("assets/intro/panel-bottom.png"),
s = new m("assets/intro/panel-left1.png"),
a = new m("assets/intro/panel-left2.png"),
o = new m("assets/intro/panel-right1.png"),
n = new m("assets/intro/panel-right2.png"),
r = new m("assets/intro/pannel-mid1.png"),
h = new m("assets/intro/pannel-mid2.png");
this._panelTopSprite = this._entity.addSprite(i), this._panelTopSprite.active = !1, this._panelBotSprite = this._entity.addSprite(e), this._panelBotSprite.active = !1, this._panelLeft1Sprite = this._entity.addSprite(s, -139), this._panelLeft1Sprite.active = !1, this._panelLeft2Sprite = this._entity.addSprite(a, -108), this._panelLeft2Sprite.active = !1, this._panelRight1Sprite = this._entity.addSprite(o, 140), this._panelRight1Sprite.active = !1, this._panelRight2Sprite = this._entity.addSprite(n, 105), this._panelRight2Sprite.active = !1, this._panelMid1Sprite = this._entity.addSprite(r), this._panelMid1Sprite.active = !1, this._panelMid2Sprite = this._entity.addSprite(h), this._panelMid2Sprite.active = !1, this._timeOuts.push(setTimeout(function() {
t._panelTopSprite.active = !0, t._panelTopSprite.drawOffsetY = -135, t._panelBotSprite.active = !0, t._panelBotSprite.drawOffsetY = 108
}, 400)), this._timeOuts.push(setTimeout(function() {
t._panelLeft1Sprite.active = !0, t._panelRight1Sprite.active = !0, t._panelTopSprite.drawOffsetY = -85, t._panelBotSprite.drawOffsetY = 79, R.playSound("assets/Audio/introHit.ogg")
}, 500)), this._timeOuts.push(setTimeout(function() {
t._panelLeft1Sprite.active = !1, t._panelRight1Sprite.active = !1, t._panelLeft2Sprite.active = !0, t._panelRight2Sprite.active = !0, t._panelTopSprite.drawOffsetY = -29, t._panelBotSprite.drawOffsetY = 71, t._vivaldiLogo.active = !0, t._vivaldiLogo.playAnimation(), t._canSkipIntro = !0
}, 600)), this._timeOuts.push(setTimeout(function() {
t._panelTopSprite.active = !1, t._panelBotSprite.active = !1, t._panelLeft2Sprite.active = !1, t._panelRight2Sprite.active = !1, t._panelMid1Sprite.active = !0
}, 700)), this._timeOuts.push(setTimeout(function() {
t._panelMid1Sprite.active = !1, t._panelMid2Sprite.active = !0
}, 800)), this._timeOuts.push(setTimeout(function() {
R.playSound("assets/Audio/glitch1.ogg")
}, 1700)), this._vivaldiLogo = _t.addSpriteFromAnimation(this._entity, "vivaldiLogoAnimation"), this._vivaldiLogo.repeatAnimation(!1), this._vivaldiLogo.drawOffsetY = -27, this._vivaldiLogo.active = !1, this._vivaldiLogo.animationFinishedCallback = function() {
t._vivaldiLogo.active = !1, t._tonyAnimation.active = !0, t._tonyAnimation.playAnimation(), t._timeOuts.push(setTimeout(function() {
R.playSound("assets/Audio/tonyYay.ogg")
}, 1200))
};
var _ = -1,
l = _t._texturesByType.tonyFrontIdle[0];
this._tonyAnimation = this._entity.addSprite(l), this._tonyAnimation.addAnimationFrame(l, 100), this._tonyAnimation.addAnimationFrame(l, 100, 0, this._tonyAnimationSin[++_]), this._tonyAnimation.addAnimationFrame(l, 100, 0, this._tonyAnimationSin[++_]), this._tonyAnimation.addAnimationFrame(l, 100, 0, this._tonyAnimationSin[++_]), this._tonyAnimation.addAnimationFrame(l, 100, 0, this._tonyAnimationSin[++_]), this._tonyAnimation.addAnimationFrame(l, 100, 0, this._tonyAnimationSin[++_]), this._tonyAnimation.addAnimationFrame(l, 100, 0, this._tonyAnimationSin[++_]);
for (var d = _t._map._animationsByType.tonyBallin, c = 0; c < d.length; c++) {
++_ % this._tonyAnimationSin.length == 0 && (_ = 0);
var p = this._tonyAnimationSin[_],
u = d[c];
this._tonyAnimation.addAnimationFrame(_t._texturesById[u._id], u._duration, 0, p)
}
this._tonyAnimation.repeatAnimation(!1), this._tonyAnimation.drawOffsetY = -12, this._tonyAnimation.active = !1, this._tonyAnimation.animationFinishedCallback = function() {
t._tonyAnimation.active = !1, t._timeOuts.push(setTimeout(function() {
t._tonyAnimation.active = !1, t._pfLogo.active = !0, t._pfLogo.playAnimation(), R.playSound("assets/Audio/whoosh.ogg")
}, 200)), t._timeOuts.push(setTimeout(function() {
R.playSound("assets/Audio/glitch2.ogg")
}, 1500))
}, this._pfLogo = _t.addSpriteFromAnimation(this._entity, "pfLogoAnimation"), this._pfLogo.drawOffsetY = -27, this._pfLogo.repeatAnimation(!1), this._pfLogo.active = !1, this._pfLogo.animationFinishedCallback = function() {
t._pfLogo.active = !1, R.playSound("assets/Audio/glitch3.ogg"), t._timeOuts.push(setTimeout(function() {
t._pfLogo.active = !1, t._vivaldiText.active = !0, t._vivaldiText.playAnimation()
}, 200)), t._timeOuts.push(setTimeout(function() {
R.playSound("assets/Audio/glimmer.ogg")
}, 400))
}, this._vivaldiText = _t.addSpriteFromAnimation(this._entity, "vivaldiTextAnimation"), this._vivaldiText.drawOffsetY = -27, this._vivaldiText.active = !1, this._vivaldiText.repeatAnimation(!1), this._vivaldiText.animationFinishedCallback = function() {
t._timeOuts.push(setTimeout(function() {
t._vivaldiText.active = !1, t._panelMid2Sprite.active = !1
}, 600)), t._timeOuts.push(setTimeout(function() {
t._startMainScene()
}, 800))
}
}
var oe = (ne.preload = function() {
var t = this,
i = new tt(this._start.bind(this), this._fixedUpdate.bind(this));
i.messageCallback = this._messageCallback.bind(this), this._spectator = 0 < lt._locationHref.indexOf("spectator=true"), this._skipIntro = 0 < lt._locationHref.indexOf("skip_intro=true"), lt.preload(i, function() {
lt._canPlaySoundAtStartup ? t.init(t._skipIntro ? Ji.Main : Ji.Intro) : t.init(Ji.ClickToPlay)
})
}, ne._messageCallback = function(t) {
t.data[0] === e.VivaldiNameSpaceFound && Gt.enableScreenshotButtonOnGameOver()
}, ne.init = function(t) {
ne._highScoreKey = "high_score_" + _t._map._filename, ne._currentScene = t, lt.init(new x("assets/interface/font.png", 7, 20)), postMessage([e.VivaldiaWorkerInitialized])
}, ne._start = function() {
switch (zi.init(), this._currentScene) {
case Ji.ClickToPlay:
new ie;
break;
case Ji.Intro:
Gi.init(), new se;
break;
case Ji.Main:
Gi.init(), $i.init(), Ei.init(), et.init(), Jt.init(), oi.init(), Yt.init(), Lt.init(), Bi.init(), Hi.init(), Yi.init()
}
}, ne._fixedUpdate = function() {
switch (zi.fixedUpdate(), $i.fixedUpdate(), this._currentScene) {
case Ji.ClickToPlay:
break;
case Ji.Intro:
Gi.fixedUpdate();
break;
case Ji.Main:
Gi.fixedUpdate(), Ei.fixedUpdate(), et.fixedUpdate(), Jt.fixedUpdate(), oi.fixedUpdate(), Yt.fixedUpdate(), Lt.fixedUpdate(), Bi.fixedUpdate(), Hi.fixedUpdate(), Yi.fixedUpdate()
}
}, ne);
function ne() {}
lt.entryPoint = oe.preload.bind(oe)
}();