Skip to content

Add invader-hit SFX on bullet collisions in Space Invaders#443

Merged
jbampton merged 2 commits intomainfrom
copilot/add-sound-on-bullet-destroy
Apr 19, 2026
Merged

Add invader-hit SFX on bullet collisions in Space Invaders#443
jbampton merged 2 commits intomainfrom
copilot/add-sound-on-bullet-destroy

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 19, 2026

Space Invaders currently has no hit feedback when bullets destroy invaders, making successful shots feel muted. This PR adds a short, synthesized hit sound on bullet→invader collisions.

  • Collision feedback wiring

    • Added hit-sound trigger to the existing bullet/alien overlap handler so each successful destroy event emits immediate audio feedback.
  • Audio implementation

    • Introduced a small Web Audio helper that generates a brief retro-style descending square-wave blip (no asset files or new dependencies).
    • Reuses a lazily initialized AudioContext to avoid per-hit context creation.
  • Runtime cleanup

    • Added oscillator.onended cleanup to disconnect temporary audio nodes after playback and prevent node buildup during rapid fire.
scene.physics.add.overlap(scene.si_bullets, scene.si_aliens, (bullet, alien) => {
  bullet.destroy();
  alien.destroy();
  _playInvaderHitSound();
});

@jbampton jbampton marked this pull request as ready for review April 19, 2026 06:44
@jbampton jbampton self-requested a review as a code owner April 19, 2026 06:44
@jbampton jbampton added the good first issue Good for newcomers label Apr 19, 2026
@jbampton jbampton added this to Next Apr 19, 2026
@jbampton jbampton added this to the Hackfest milestone Apr 19, 2026
@github-project-automation github-project-automation bot moved this to In progress in Next Apr 19, 2026
@jbampton jbampton moved this from In progress to Review in progress in Next Apr 19, 2026
@jbampton jbampton merged commit d0b32c3 into main Apr 19, 2026
12 of 13 checks passed
@jbampton jbampton deleted the copilot/add-sound-on-bullet-destroy branch April 19, 2026 06:46
@github-project-automation github-project-automation bot moved this from Review in progress to Done in Next Apr 19, 2026
Copilot AI added a commit that referenced this pull request Apr 19, 2026
* Add hit sound when Space Invaders bullet destroys an invader

Agent-Logs-Url: https://github.com/NextCommunity/NextCommunity.github.io/sessions/2e21a107-94cf-4f0c-8d3f-8dae8d66ef0b

Co-authored-by: jbampton <418747+jbampton@users.noreply.github.com>

* Clean up Web Audio nodes after invader hit sound

Agent-Logs-Url: https://github.com/NextCommunity/NextCommunity.github.io/sessions/2e21a107-94cf-4f0c-8d3f-8dae8d66ef0b

Co-authored-by: jbampton <418747+jbampton@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: jbampton <418747+jbampton@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

good first issue Good for newcomers

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants