Skip to content

Commit 7e6f931

Browse files
Copilotjbampton
andauthored
Remove pre-start animations for Space Invaders (#439)
Agent-Logs-Url: https://github.com/NextCommunity/NextCommunity.github.io/sessions/7a2c3d4c-134f-4fb6-aeaa-9161764680a3 Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: jbampton <418747+jbampton@users.noreply.github.com>
1 parent 6d33863 commit 7e6f931

File tree

2 files changed

+3
-94
lines changed

2 files changed

+3
-94
lines changed

src/assets/js/eggs.js

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,10 @@
2222

2323
heartClickCount++;
2424

25-
// Visual feedback: heart grows with each click
26-
const scaleAmount = 1 + heartClickCount * 0.3;
27-
heart.style.transition =
28-
"transform 0.1s cubic-bezier(0.17, 0.67, 0.83, 0.67)";
29-
heart.style.transform = `scale(${scaleAmount})`;
30-
3125
if (heartClickCount === 5) {
3226
phaserStarted = true;
3327
heart.innerHTML = "🎮";
34-
heart.style.transform = "scale(1.5)";
35-
36-
setTimeout(() => {
37-
heart.style.opacity = "0";
38-
SpaceInvaders.launch();
39-
}, 300);
28+
SpaceInvaders.launch();
4029
}
4130
});
4231
})();

src/assets/js/games/space-invaders.js

Lines changed: 2 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -9,41 +9,6 @@
99
*/
1010

1111
const SpaceInvaders = (() => {
12-
// ─── Emoji assets ────────────────────────────────────────────────────────
13-
14-
const BURST_EMOJIS = [
15-
"🎮",
16-
"🕹️",
17-
"👾",
18-
"🚀",
19-
"✨",
20-
"⭐",
21-
"🔥",
22-
"💥",
23-
"🌈",
24-
"🎉",
25-
"💖",
26-
"💎",
27-
"🤖",
28-
"👻",
29-
"🦄",
30-
"🍄",
31-
"🌍",
32-
"⚡",
33-
"🏆",
34-
"🎯",
35-
"🛸",
36-
"👽",
37-
"👾",
38-
"🐙",
39-
"🦖",
40-
"🪐",
41-
"🌌",
42-
"🌠",
43-
"☄️",
44-
"🌙",
45-
];
46-
4712
const ALIEN_ROWS = ["👾", "👽", "🛸", "🐙", "👾"];
4813
const GAME_ID = "space-invaders";
4914

@@ -70,7 +35,7 @@ const SpaceInvaders = (() => {
7035
width: "100vw",
7136
height: "100vh",
7237
zIndex: "10000",
73-
pointerEvents: "none", // non-interactive until explosion is done
38+
pointerEvents: "auto",
7439
});
7540
document.body.appendChild(canvas);
7641

@@ -97,24 +62,7 @@ const SpaceInvaders = (() => {
9762
// ─── Scene callbacks ─────────────────────────────────────────────────────
9863

9964
function _onCreate() {
100-
const particles = _spawnExplosion(this);
101-
102-
// After 5 s, fade out the explosion and start the real game
103-
this.time.delayedCall(5000, () => {
104-
this.tweens.add({
105-
targets: particles.getChildren(),
106-
alpha: 0,
107-
duration: 1000,
108-
onComplete: () => {
109-
particles.clear(true, true);
110-
111-
const canvas = document.getElementById("game-canvas-" + GAME_ID);
112-
if (canvas) canvas.style.pointerEvents = "auto";
113-
114-
_setupGame(this);
115-
},
116-
});
117-
});
65+
_setupGame(this);
11866
}
11967

12068
function _onUpdate() {
@@ -135,34 +83,6 @@ const SpaceInvaders = (() => {
13583

13684
// ─── Game setup ──────────────────────────────────────────────────────────
13785

138-
function _spawnExplosion(scene) {
139-
const heartEl = document.getElementById("footer-heart");
140-
const rect = heartEl
141-
? heartEl.getBoundingClientRect()
142-
: { left: window.innerWidth / 2, top: window.innerHeight - 60 };
143-
144-
const group = scene.add.group();
145-
146-
for (let i = 0; i < 40; i++) {
147-
const emoji = Phaser.Utils.Array.GetRandom(BURST_EMOJIS);
148-
const p = scene.add.text(rect.left, rect.top, emoji, {
149-
fontSize: "32px",
150-
});
151-
152-
scene.physics.add.existing(p);
153-
p.body.setVelocity(
154-
Phaser.Math.Between(-400, 400),
155-
Phaser.Math.Between(-600, -1200),
156-
);
157-
p.body.setBounce(0.6);
158-
p.body.setCollideWorldBounds(true);
159-
p.body.setAngularVelocity(Phaser.Math.Between(-200, 200));
160-
group.add(p);
161-
}
162-
163-
return group;
164-
}
165-
16686
function _setupGame(scene) {
16787
// Player rocket
16888
scene.si_player = scene.add.text(

0 commit comments

Comments
 (0)