From c292564ea7bf665b82b8c79360656eba249ff4d6 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 19 Apr 2026 06:23:08 +0000 Subject: [PATCH 1/2] Space Invaders: cleanup offscreen bullets and black canvas background Agent-Logs-Url: https://github.com/NextCommunity/NextCommunity.github.io/sessions/4a92f727-d408-427a-8bee-fc96696e3d01 Co-authored-by: jbampton <418747+jbampton@users.noreply.github.com> --- src/assets/js/games/space-invaders.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/assets/js/games/space-invaders.js b/src/assets/js/games/space-invaders.js index 980248a..19e980e 100644 --- a/src/assets/js/games/space-invaders.js +++ b/src/assets/js/games/space-invaders.js @@ -36,6 +36,7 @@ const SpaceInvaders = (() => { height: "100vh", zIndex: "10000", pointerEvents: "auto", + background: "#000000", }); document.body.appendChild(canvas); @@ -44,7 +45,8 @@ const SpaceInvaders = (() => { canvas: canvas, width: window.innerWidth, height: window.innerHeight, - transparent: true, + transparent: false, + backgroundColor: "#000000", physics: { default: "arcade", arcade: { gravity: { y: 0 }, debug: false }, @@ -79,6 +81,14 @@ const SpaceInvaders = (() => { if (this.si_cursors.space.isDown) { _fireBullet(this); } + + const bullets = this.si_bullets?.getChildren?.() || []; + bullets.forEach((bullet) => { + if (!bullet.active) return; + if (bullet.y < -40 || bullet.x < -40 || bullet.x > this.scale.width + 40) { + bullet.destroy(); + } + }); } // ─── Game setup ────────────────────────────────────────────────────────── From c99ea46477aa20fa340f1523df89a2be7fa90a4f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 19 Apr 2026 06:26:04 +0000 Subject: [PATCH 2/2] Space Invaders: extract bullet cleanup buffer constant Agent-Logs-Url: https://github.com/NextCommunity/NextCommunity.github.io/sessions/4a92f727-d408-427a-8bee-fc96696e3d01 Co-authored-by: jbampton <418747+jbampton@users.noreply.github.com> --- src/assets/js/games/space-invaders.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/assets/js/games/space-invaders.js b/src/assets/js/games/space-invaders.js index 19e980e..1f09de4 100644 --- a/src/assets/js/games/space-invaders.js +++ b/src/assets/js/games/space-invaders.js @@ -11,6 +11,7 @@ const SpaceInvaders = (() => { const ALIEN_ROWS = ["👾", "👽", "🛸", "🐙", "👾"]; const GAME_ID = "space-invaders"; + const BULLET_CLEANUP_BUFFER = 40; // ─── Public entry-point ────────────────────────────────────────────────── @@ -85,7 +86,11 @@ const SpaceInvaders = (() => { const bullets = this.si_bullets?.getChildren?.() || []; bullets.forEach((bullet) => { if (!bullet.active) return; - if (bullet.y < -40 || bullet.x < -40 || bullet.x > this.scale.width + 40) { + if ( + bullet.y < -BULLET_CLEANUP_BUFFER || + bullet.x < -BULLET_CLEANUP_BUFFER || + bullet.x > this.scale.width + BULLET_CLEANUP_BUFFER + ) { bullet.destroy(); } });