Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 19 additions & 13 deletions assets/scripts/core/game-scene.js
Original file line number Diff line number Diff line change
Expand Up @@ -4032,6 +4032,15 @@ this._menuUpdateLogBtn = this.add.image(screenWidth - 30 - 50, 33, "GJ_WebSheet"
const bgHex = LEVEL_COLORS[index % LEVEL_COLORS.length];
return { bgHex, groundHex: bgHex };
}

_getLevelCoinRequirement(levelId) {

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved and changed name for more acceciblity

const levelCoinRequirements = {
"level_14": 10,
"level_18": 20,
"level_20": 30
};
return levelCoinRequirements[levelId] || 0;
}
_openLevelSelect() {
if (this._levelSelectOverlay) return;
const sw = screenWidth;
Expand Down Expand Up @@ -4059,12 +4068,6 @@ this._menuUpdateLogBtn = this.add.image(screenWidth - 30 - 50, 33, "GJ_WebSheet"
}
};
const isEveryEnd = (levelId) => levelId === "level_99";
const levelCoinRequirements = {
"level_14": 10,
"level_18": 20,
"level_20": 30
};
const getLevelCoinRequirement = (levelId) => levelCoinRequirements[levelId] || 0;
const fadeIn = this.add.graphics().setScrollFactor(0).setDepth(200);
fadeIn.fillStyle(0x000000, 1);
fadeIn.fillRect(0, 0, sw, sh);
Expand Down Expand Up @@ -4231,7 +4234,7 @@ this._menuUpdateLogBtn = this.add.image(screenWidth - 30 - 50, 33, "GJ_WebSheet"
onDragStart(ptr);
if (isComingSoonPage()) return;
const levelId = window.currentlevel?.[2];
if (getLevelCoinRequirement(levelId) > (Number(window._totalsecretcoins) || 0)) return;
if (this._getLevelCoinRequirement(levelId) > (Number(window._totalsecretcoins) || 0)) return;
this.tweens.killTweensOf(cardBounceContainer, "scale");
this.tweens.add({ targets: cardBounceContainer, scale: 1.26, duration: 300, ease: "Bounce.Out" });
});
Expand Down Expand Up @@ -4293,7 +4296,7 @@ this._menuUpdateLogBtn = this.add.image(screenWidth - 30 - 50, 33, "GJ_WebSheet"
return;
}

const requiredCoins = getLevelCoinRequirement(window.currentlevel?.[2]);
const requiredCoins = this._getLevelCoinRequirement(window.currentlevel?.[2]);
const collectedCoins = Number(window._totalsecretcoins) || 0;
if (requiredCoins > collectedCoins) {
return;
Expand Down Expand Up @@ -4356,7 +4359,7 @@ this._menuUpdateLogBtn = this.add.image(screenWidth - 30 - 50, 33, "GJ_WebSheet"
}
const lvl = window.currentlevel;
const levelId = lvl[2] || "level_1";
const requiredCoins = getLevelCoinRequirement(levelId);
const requiredCoins = this._getLevelCoinRequirement(levelId);
const collectedCoins = Number(window._totalsecretcoins) || 0;
const levellocked = requiredCoins > collectedCoins;
const levelDifficultyMap = {
Expand Down Expand Up @@ -8103,6 +8106,9 @@ _showwippopup() {
if (this._levelSelectIsComingSoonPage) {
return;
}
if (this._getLevelCoinRequirement(window.currentlevel?.[2]) > (Number(window._totalsecretcoins) || 0)) {
return;
}
this._creatorMenuOpen;
this.input.enabled = false;

Expand Down Expand Up @@ -9126,7 +9132,7 @@ _applyMirrorEffect() {
if (this._updatePracticeHUDBar) this._updatePracticeHUDBar();
}

const _0x356782 = this._level.endXPos - this._cameraX;
const _0x356782 = this._getMirrorXOffset(this._level.endXPos - this._cameraX);
const _0x2d967b = b(this._endPortalGameY) + this._cameraY;
for (let _0x481f7c = 0; _0x481f7c < 5; _0x481f7c++) {
this.time.delayedCall(_0x481f7c * 50, () => circleEffect(this, _0x356782, _0x2d967b, 10, screenWidth, 500, false, true, window.mainColor));
Expand Down Expand Up @@ -9170,7 +9176,7 @@ _applyMirrorEffect() {
const _0x2e9531 = _0x1c105b + _0x586720 * (Math.random() * 2 - 1);
const _0x28e7b3 = Math.min(1, Math.max(0, _0x4da54f + _0x20decf * (Math.random() * 2 - 1)));
const _0x34147c = _0x44369e[_0x104cbb] + _0x323ded * Math.random() + 180;
const containerY = _0x3f5321.add.graphics().setScrollFactor(0).setDepth(-1).setBlendMode(S).setPosition(_0x8f5267, _0x2f1e2d).setAngle(_0x34147c).setAlpha(_0x28e7b3).setVisible(false);
const containerY = _0x3f5321.add.graphics().setScrollFactor(0).setDepth(-1).setBlendMode(S).setPosition(_0x8f5267, _0x2f1e2d).setAngle(_0x3f5321._state.mirrored ? -_0x34147c : _0x34147c).setAlpha(_0x28e7b3).setVisible(false);
const _0x496d96 = {
h: 1,
w: _0x2cc21f
Expand Down Expand Up @@ -9215,7 +9221,7 @@ _applyMirrorEffect() {
});
}
});
})(this, this._level.endXPos - this._cameraX + 60, b(this._endPortalGameY) + this._cameraY, window.mainColor);
})(this, this._getMirrorXOffset(this._level.endXPos - this._cameraX + 60), b(this._endPortalGameY) + this._cameraY, window.mainColor);
this.cameras.main.shake(1950, 0.004);
this.time.delayedCall(1950, () => this._showCompleteText());
}
Expand Down Expand Up @@ -9278,7 +9284,7 @@ _applyMirrorEffect() {
}
}).setScrollFactor(0).setDepth(59);
}
const _0x2eadf2 = this._level.endXPos - this._cameraX;
const _0x2eadf2 = this._getMirrorXOffset(this._level.endXPos - this._cameraX);
const _0x380b24 = b(this._endPortalGameY) + this._cameraY;
circleEffect(this, _0x2eadf2, _0x380b24, 10, screenWidth, 800, true, false, window.mainColor);
circleEffect(this, _0x56628c, 250, 10, 1000, 800, true, false, window.mainColor);
Expand Down
32 changes: 21 additions & 11 deletions assets/scripts/core/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -1816,7 +1816,8 @@ class PlayerObject {
if (this.p.isFlying || this.p.isUfo) {
const _0x3904f8 = 10;
const _miniS = this.p.isMini ? 0.6 : 1;
const playerOffset = this.p.gravityFlipped ? (-30 * _miniS) : (10 * _miniS);
const _miniCubeOffset = this.p.isMini ? (8 * _miniS) : 0;
const playerOffset = (this.p.gravityFlipped ? (-30 * _miniS) : (10 * _miniS)) - _miniCubeOffset;
const cosRotation = Math.cos(playerRotation);
const sinRotation = Math.sin(playerRotation);
const mirrored = this.p.mirrored ? -1 : 1;
Expand Down Expand Up @@ -1855,7 +1856,7 @@ if (this.p.isFlying || this.p.isUfo) {
if (playerLayerItem) {
const _miniS = this.p.isMini ? 0.6 : 1;
playerLayerItem.sprite.x = _0x7f0705 + _0x562424;
playerLayerItem.sprite.y = (_0x1a433c + _0x3011c9) + (this.p.isMini ? (8 * _miniS) : 0) + (this.p.gravityFlipped ? (-20 * _miniS) : 0);
playerLayerItem.sprite.y = (_0x1a433c + _0x3011c9) + (this.p.gravityFlipped ? (-20 * _miniS) : 0);
playerLayerItem.sprite.rotation = this.p.mirrored ? -playerRotation : playerRotation;
const _shipCubeS = _miniS * 0.55;
playerLayerItem.sprite.scaleY = this.p.gravityFlipped ? -_shipCubeS : _shipCubeS;
Expand All @@ -1874,7 +1875,7 @@ if (this.p.isFlying || this.p.isUfo) {
const birdX = _0x7f0705 + _0x1b1d28;
const birdY = _0x1a433c + _0x185f91 + (this.p.gravityFlipped ? -15 : 5);
const cubeX = _0x7f0705 + _0x562424;
const cubeY = (_0x1a433c + _0x3011c9) + (this.p.isMini ? (8 * _miniS) : 0) + (this.p.gravityFlipped ? (-20 * _miniS) : 0);
const cubeY = (_0x1a433c + _0x3011c9) + (this.p.gravityFlipped ? (-20 * _miniS) : 0);
const offsetX = cubeX - birdX;
const offsetY = cubeY - birdY;
const rotationDelta = uforotation - currentRotation;
Expand Down Expand Up @@ -3462,14 +3463,23 @@ if (this.p.isFlying || this.p.isUfo) {
const miniRollScale = this.p.isMini ? 1 / 0.8 : 1;
this._rotation += _0x1dd8af / (g / 2) * rollDir * speedFactor * bidenblast* miniRollScale;
}
updateShipRotation(_0x217ad3) {
let _0x48f422 = -(this.p.y - this.p.lastY);
let _0x58cb3a = _0x217ad3 * 10.3860036;
if (_0x58cb3a * _0x58cb3a + _0x48f422 * _0x48f422 >= _0x217ad3 * 0.6) {
let _0x5e6a2b = Math.atan2(_0x48f422, _0x58cb3a);
let _0x2371ed = 0.15;
let _0x1857d4 = Math.min(_0x217ad3 * 1, _0x2371ed * _0x217ad3);
this._rotation = this.slerp2D(this._rotation, _0x5e6a2b, _0x1857d4);
updateShipRotation(delta) {

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

update readablity

const isMini = this.p.isMini;
const deltaY = -(this.p.y - this.p.lastY);
const deltaX = delta * (isMini ? 16.5 : 8);

const speedSquared = deltaX * deltaX + deltaY * deltaY;
const movementThreshold = delta * 0.4;

if (speedSquared >= movementThreshold) {
let targetRotation = Math.atan2(deltaY, deltaX);

const maxPitch = isMini ? 0.66 : 0.70;
targetRotation = Phaser.Math.Clamp(targetRotation, -maxPitch, maxPitch);

const turnRate = isMini ? 0.20 : 0.15;
const turnStep = Math.min(delta, turnRate * delta);
this._rotation = this.slerp2D(this._rotation, targetRotation, turnStep);
}
}
breakabletheblock(gameObj) {
Expand Down