From 79a605683483bcdde87a32d2ef53e5068cc4ce1d Mon Sep 17 00:00:00 2001 From: Noah Petherbridge Date: Thu, 9 Mar 2023 22:57:30 -0800 Subject: [PATCH] New sound effects --- bird/Makefile | 1 + bird/bird.js | 19 ++++++++++++++++++- buttons/button.js | 4 ++-- buttons/sticky.js | 4 ++-- crumbly-floor/crumbly-floor.js | 3 ++- crusher/crusher.js | 2 +- doors/colored-door.js | 10 +++++++--- doors/electric-door.js | 4 ++-- doors/keys.js | 4 +++- gems/gemstone.js | 4 +++- objects/anvil.js | 4 ++-- on-off/state-button.js | 1 + regions/Makefile | 4 ++++ regions/solid-64.png | Bin 0 -> 767 bytes regions/solid.js | 9 +++++++++ switches/switch.js | 2 +- thief/thief.js | 2 ++ trapdoors/electric-trapdoor.js | 2 ++ warp-door/warp-door.js | 1 + 19 files changed, 63 insertions(+), 17 deletions(-) create mode 100644 regions/solid-64.png create mode 100644 regions/solid.js diff --git a/bird/Makefile b/bird/Makefile index d0ff88d..cca8473 100644 --- a/bird/Makefile +++ b/bird/Makefile @@ -17,6 +17,7 @@ build: # Tag the category for these doodads for i in *.doodad; do\ doodad edit-doodad --tag "category=creatures" $${i};\ + doodad edit-doodad -q --option "No A.I.=bool" $${i};\ done cp *.doodad ../../../assets/doodads/ \ No newline at end of file diff --git a/bird/bird.js b/bird/bird.js index 9a236d8..a08f3b8 100644 --- a/bird/bird.js +++ b/bird/bird.js @@ -42,6 +42,11 @@ function main() { return player(); } + // No A.I.? + if (Self.GetOption("No A.I.") === true) { + return; + } + Events.OnCollide((e) => { // If we're diving and we hit the player, game over! if (e.Settled && state === states.diving && e.Actor.IsPlayer()) { @@ -81,6 +86,11 @@ function main() { } sampleTick++; + // Play the bird flap sound if we are on screen. + if (Self.IsOnScreen()) { + Sound.Play("bird-fly.mp3"); + } + // Are we diving? if (state === states.diving) { Vy = speed @@ -161,6 +171,7 @@ function AI_ScanForPlayer() { scanY += stepY; for (let actor of Actors.At(Point(scanX, scanY))) { if (actor.IsPlayer() && actor.HasGravity()) { + Sound.Play("bird-dive.mp3"); state = states.diving; return; } @@ -233,10 +244,12 @@ function player() { if (ev.Down && ev.Right && falling) { Self.StopAnimation(); Self.ShowLayerNamed("dive-right"); + Sound.Play("bird-dive.mp3"); diving = falling; } else if (ev.Down && ev.Left && falling) { Self.StopAnimation(); Self.ShowLayerNamed("dive-left"); + Sound.Play("bird-dive.mp3"); diving = falling; } else if (ev.Right) { // Fly right. @@ -260,6 +273,10 @@ function player() { diving = false; } + if (!diving) { + Sound.Play("bird-fly.mp3"); + } + // Player is invulnerable while diving. Self.SetInvulnerable(diving); }); @@ -267,7 +284,7 @@ function player() { Events.OnCollide((e) => { // If the player is diving at an enemy mob, destroy it. if (diving && e.Settled && e.Actor.IsMobile() && !e.Actor.Invulnerable()) { - Sound.Play("crumbly-break.wav"); + Sound.Play("crumbly-break.mp3"); e.Actor.Destroy(); } }); diff --git a/buttons/button.js b/buttons/button.js index a07bba2..f96080c 100644 --- a/buttons/button.js +++ b/buttons/button.js @@ -33,7 +33,7 @@ function main() { } if (!pressed && !stickyDown) { - Sound.Play("button-down.wav") + Sound.Play("button-down.mp3") Message.Publish("power", true); pressed = true; } @@ -50,7 +50,7 @@ function main() { delete colliders[e.Actor.ID()]; if (Object.keys(colliders).length === 0 && !stickyDown) { - Sound.Play("button-up.wav") + Sound.Play("button-up.mp3") Self.ShowLayer(0); Message.Publish("power", false); timer = 0; diff --git a/buttons/sticky.js b/buttons/sticky.js index e9d6866..0fd889b 100644 --- a/buttons/sticky.js +++ b/buttons/sticky.js @@ -6,7 +6,7 @@ function main() { if (powered && pressed) { Self.ShowLayer(0); pressed = false; - Sound.Play("button-up.wav") + Sound.Play("button-up.mp3") Message.Publish("power", false); Message.Publish("sticky:down", false); } @@ -26,7 +26,7 @@ function main() { return; } - Sound.Play("button-down.wav") + Sound.Play("button-down.mp3") Self.ShowLayer(1); pressed = true; Message.Publish("power", true); diff --git a/crumbly-floor/crumbly-floor.js b/crumbly-floor/crumbly-floor.js index 283bd65..b76747f 100644 --- a/crumbly-floor/crumbly-floor.js +++ b/crumbly-floor/crumbly-floor.js @@ -37,10 +37,11 @@ function main() { // Begin the animation sequence if we're in the solid state. if (state === stateSolid) { state = stateShaking; + Sound.Play("crumbly-rumble.mp3"); Self.PlayAnimation("shake", () => { state = stateFalling; Self.PlayAnimation("fall", () => { - Sound.Play("crumbly-break.wav") + Sound.Play("crumbly-break.mp3") state = stateFallen; Self.ShowLayerNamed("fallen"); diff --git a/crusher/crusher.js b/crusher/crusher.js index 5aba2a2..d69ee0c 100644 --- a/crusher/crusher.js +++ b/crusher/crusher.js @@ -156,7 +156,7 @@ function main() { // Landed? if (point.Y === lastAltitude) { - Sound.Play("crumbly-break.wav") + Sound.Play("crumbly-break.mp3") state = states.hit; Self.PlayAnimation("hit", () => { state = states.rising; diff --git a/doors/colored-door.js b/doors/colored-door.js index b529d57..d3bfd14 100644 --- a/doors/colored-door.js +++ b/doors/colored-door.js @@ -50,7 +50,9 @@ function main() { if (unlocked) { Self.ShowLayer(enterSide < 0 ? layer.right : layer.left); opened = true; - Sound.Play("door-open.wav") + if (Self.IsOnScreen()) { + Sound.Play("door-open.mp3"); + } return; } @@ -64,7 +66,9 @@ function main() { if (e.Settled) { unlocked = true; Self.ShowLayer(enterSide < 0 ? layer.right : layer.left); - Sound.Play("unlock.wav"); + if (Self.IsOnScreen()) { + Sound.Play("unlock.mp3"); + } // If a Small Key door, consume a small key. if (color === "small") { @@ -75,7 +79,7 @@ function main() { }); Events.OnLeave((e) => { Self.ShowLayer(unlocked ? layer.unlocked : layer.closed); - // Sound.Play("door-close.wav") + // Sound.Play("door-close.mp3") // Reset collision state. opened = false; diff --git a/doors/electric-door.js b/doors/electric-door.js index 07e274b..886205d 100644 --- a/doors/electric-door.js +++ b/doors/electric-door.js @@ -23,13 +23,13 @@ function setPoweredState(powered) { animating = true; opened = true; - Sound.Play("electric-door.wav") + Sound.Play("electric-door.mp3") Self.PlayAnimation("open", () => { animating = false; }); } else { animating = true; - Sound.Play("electric-door.wav") + Sound.Play("electric-door.mp3") Self.PlayAnimation("close", () => { opened = false; animating = false; diff --git a/doors/keys.js b/doors/keys.js index 23be9fe..89b5486 100644 --- a/doors/keys.js +++ b/doors/keys.js @@ -23,7 +23,9 @@ function main() { return; } - Sound.Play("item-get.wav") + if (Self.IsOnScreen()) { + Sound.Play("item-get.mp3") + } e.Actor.AddItem(Self.Filename, quantity); Self.Destroy(); } diff --git a/gems/gemstone.js b/gems/gemstone.js index 73ec353..ea6ecaa 100644 --- a/gems/gemstone.js +++ b/gems/gemstone.js @@ -14,7 +14,9 @@ function main() { Events.OnCollide((e) => { if (e.Settled) { if (e.Actor.HasInventory()) { - Sound.Play("item-get.wav") + if (Self.IsOnScreen()) { + Sound.Play("coin-drop.mp3") + } e.Actor.AddItem(Self.Filename, 1); Self.Destroy(); } diff --git a/objects/anvil.js b/objects/anvil.js index 2a5a94a..5f25e9c 100644 --- a/objects/anvil.js +++ b/objects/anvil.js @@ -31,13 +31,13 @@ function main() { if (e.InHitbox) { if (e.Actor.IsPlayer()) { // Fatal to the player. - Sound.Play("crumbly-break.wav"); + Sound.Play("cling.mp3"); FailLevel("Watch out for anvils!"); return; } else if (e.Actor.IsMobile() && !e.Actor.Invulnerable()) { // Destroy mobile doodads. - Sound.Play("crumbly-break.wav"); + Sound.Play("cling.mp3"); e.Actor.Destroy(); } } diff --git a/on-off/state-button.js b/on-off/state-button.js index 291260c..b90d4a3 100644 --- a/on-off/state-button.js +++ b/on-off/state-button.js @@ -31,6 +31,7 @@ function main() { colliding = true; state = !state; + Sound.Play(state ? "activate.mp3" : "deactivate.mp3"); Message.Broadcast("broadcast:state-change", state); showSprite(); diff --git a/regions/Makefile b/regions/Makefile index afdd10c..c8474e1 100644 --- a/regions/Makefile +++ b/regions/Makefile @@ -20,6 +20,10 @@ build: doodad edit-doodad --tag "ms=250" reg-stall-250.doodad doodad install-script stall.js reg-stall-250.doodad + # Solid Region + doodad convert -t "Solid Barrier" solid-64.png reg-solid-64.doodad + doodad install-script solid.js reg-solid-64.doodad + # Power Source doodad convert -t "Power Source" power-64.png power-source.doodad doodad install-script power.js power-source.doodad diff --git a/regions/solid-64.png b/regions/solid-64.png new file mode 100644 index 0000000000000000000000000000000000000000..c5d897faac22f84588d0e41f6570c119943558f0 GIT binary patch literal 767 zcmVEX>4Tx04R}tkv&MmP!xqvQ>7vmhjtKg$WWc^q9VH0DionYs1;guFnQ@8G-*gu zTpR`0f`dPcRR)WQiH^gTvt4P<6LrC;F(b~o0%t$5{soSR=Sv#O^tYpIHqbkJ}{ee5``6Cn5uTIO`ldV(xdr;yyt%c{aryvcX;$eQ;NTD# zD^d2k&%67&=l1WN_WXVTbT@LR#*QO}00006VoOIv0RI600RN!9r;`8x010qNS#tmY z3ljhU3ljkVnw%H_000McNliru=K>Q12pY{x@g)EN0Q^ZrK~#9!?VH;TgD?yL31T#M z$_(t(-QX*#6~#0TwOa6<)DIBkaoCAV)s)w~PXlbPEm^L&_T$}tVV;5$UO { + // Solid to everybody - the whole canvas hitbox. + return false; + }); +} diff --git a/switches/switch.js b/switches/switch.js index 99fa153..930ffa9 100644 --- a/switches/switch.js +++ b/switches/switch.js @@ -18,7 +18,7 @@ function main() { } if (collide === false) { - Sound.Play("button-down.wav") + Sound.Play("button.mp3") state = !state; Message.Publish("switch:toggle", state); diff --git a/thief/thief.js b/thief/thief.js index 77c2a70..4c52c76 100644 --- a/thief/thief.js +++ b/thief/thief.js @@ -53,11 +53,13 @@ function stealable() { // If the player lost their items, notify them. if (victim.IsPlayer() && stolen > 0) { + Sound.Play("laugh.mp3"); Flash("Watch out for thieves! %d item%s stolen!", parseInt(stolen), stolen === 1 ? ' was' : 's were'); } // If the Thief IS the player, notify your earnings. if (Self.IsPlayer() && stolen > 0) { + Sound.Play("laugh.mp3"); Flash("Awesome! Stole %d item%s from the %s!", parseInt(stolen), stolen === 1 ? '' : 's', e.Actor.Drawing.Doodad.Title); } } diff --git a/trapdoors/electric-trapdoor.js b/trapdoors/electric-trapdoor.js index 8f69dc9..cdba141 100644 --- a/trapdoors/electric-trapdoor.js +++ b/trapdoors/electric-trapdoor.js @@ -52,6 +52,7 @@ function setPoweredState(powered) { } animating = true; + Sound.Play("gears.mp3"); Self.PlayAnimation("open", function () { isOpen = true; animating = false; @@ -63,6 +64,7 @@ function setPoweredState(powered) { }); } else { animating = true; + Sound.Play("gears.mp3"); Self.PlayAnimation("close", function () { isOpen = false; animating = false; diff --git a/warp-door/warp-door.js b/warp-door/warp-door.js index 0e1965c..73d920a 100644 --- a/warp-door/warp-door.js +++ b/warp-door/warp-door.js @@ -131,6 +131,7 @@ function main() { // Play the open and close animation. animating = true; + Sound.Play("door-opening.mp3"); Self.PlayAnimation("open", () => { e.Actor.Hide() Self.PlayAnimation("close", () => {