New mechanics: coins + magnet + Gas Limit shield

Coins: collectible  dropped in clusters (lines/arcs) above platforms; collected on overlap, banked into a persistent wallet at game over, shown in HUD and on the GameOver screen. Magnet power-up pulls nearby coins toward the player for 6s (HUD duration bar). Gas Limit shield power-up grants a cyan aura that absorbs one enemy hit instead of dying, then breaks. New procedural textures (coin/magnet/shield), spawn weights, durations, sound, and stats (coins collected, GWEI wallet) wired through ScoreManager/StatsManager/Settings. Verified via in-browser sim: coins spawn, magnet pull 100px to 10px, collect increments GWEI, shield absorbs a hit (no game over) while no shield = death.
This commit is contained in:
2026-06-01 03:01:01 +07:00
parent 7c6a792212
commit be1933f3ba
14 changed files with 366 additions and 11 deletions

33
src/entities/Magnet.js Normal file
View File

@@ -0,0 +1,33 @@
import { Physics } from 'phaser';
export class Magnet extends Physics.Arcade.Sprite {
constructor(scene, x, y) {
super(scene, x, y, 'magnet');
scene.add.existing(this);
scene.physics.add.existing(this, true);
this.setScale(0.8);
this.body.setSize(this.width * 0.8, this.height * 0.8);
this.body.setOffset(this.width * 0.1, this.height * 0.1);
this.consumed = false;
this.floatTween = scene.tweens.add({
targets: this, y: y - 6, duration: 700, yoyo: true, repeat: -1, ease: 'Sine.easeInOut',
});
}
onPlayerTouch(player) {
if (this.consumed) return false;
this.consumed = true;
this.body.enable = false;
this.setVisible(false);
player.startMagnet();
this.destroy();
return true;
}
destroy(fromScene) {
if (this.floatTween) { this.floatTween.stop(); this.floatTween = null; }
super.destroy(fromScene);
}
}