diff options
author | Logan Hunt <loganhunt@simponic.xyz> | 2022-04-19 16:51:15 -0600 |
---|---|---|
committer | Logan Hunt <loganhunt@simponic.xyz> | 2022-04-19 16:51:15 -0600 |
commit | 20b7944602626f19a538e976a57d1d344e10f71b (patch) | |
tree | 24896f9fcc4d2095a64e0ae58cd513b88f41e282 /src/systems/collision.js | |
parent | 58ceff79496f60969eecb28a767b1ea28292becb (diff) | |
download | bbiy-20b7944602626f19a538e976a57d1d344e10f71b.tar.gz bbiy-20b7944602626f19a538e976a57d1d344e10f71b.zip |
Add music/sounds; fix a bug where you could attempt to resume a game when it was won
Diffstat (limited to 'src/systems/collision.js')
-rw-r--r-- | src/systems/collision.js | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/systems/collision.js b/src/systems/collision.js index 013ae1e..0732c74 100644 --- a/src/systems/collision.js +++ b/src/systems/collision.js @@ -11,6 +11,7 @@ game.system.Collision = (entitiesGrid) => { burnedParticleSpawner.addComponent(game.components.Appearance({width: game.canvas.width / game.config.xDim, height: game.canvas.height / game.config.yDim})); game.entities[burnedParticleSpawner.id] = burnedParticleSpawner; entity.removeComponent("alive"); + game.assets.death.play(); break; } else if (entity.hasComponent("sinkable") && collided.hasComponent("sink")) { const sunkParticleSpawner = game.createBorderParticles({colors: ["#16f7c9", "#0d6e5a", "#2fa18a", "#48cfb4", "#58877d", "#178054", "#2cdb92"]}); @@ -19,6 +20,7 @@ game.system.Collision = (entitiesGrid) => { game.entities[sunkParticleSpawner.id] = sunkParticleSpawner; entity.removeComponent("alive"); collided.removeComponent("alive"); + game.assets.death.play(); break; } } @@ -27,6 +29,8 @@ game.system.Collision = (entitiesGrid) => { if (entity.hasComponent("controllable") && entity.hasComponent("gridPosition")) { for (let collided of entitiesGrid[entity.components.gridPosition.y][entity.components.gridPosition.x].values()) { if (collided.hasComponent("win")) { + game.assets.win.play(); + game.win = true; game.systems.menu.bringUpMenu(); game.systems.menu.setState("levelSelect"); } @@ -70,6 +74,7 @@ game.system.Collision = (entitiesGrid) => { if (wall) { entity.removeComponent("momentum"); } else { + game.assets.move.play(); entitiesToPush.map((e) => { const pushedParticleSpawner = game.createBorderParticles({maxSpeed: 0.1, minAmount: 10, maxAmount: 15}); pushedParticleSpawner.addComponent(game.components.Position(e.components.position)); |