New sound effects

This commit is contained in:
Noah 2023-03-09 22:57:30 -08:00
parent 220a87d9d1
commit 79a6056834
19 changed files with 63 additions and 17 deletions

View File

@ -17,6 +17,7 @@ build:
# Tag the category for these doodads # Tag the category for these doodads
for i in *.doodad; do\ for i in *.doodad; do\
doodad edit-doodad --tag "category=creatures" $${i};\ doodad edit-doodad --tag "category=creatures" $${i};\
doodad edit-doodad -q --option "No A.I.=bool" $${i};\
done done
cp *.doodad ../../../assets/doodads/ cp *.doodad ../../../assets/doodads/

View File

@ -42,6 +42,11 @@ function main() {
return player(); return player();
} }
// No A.I.?
if (Self.GetOption("No A.I.") === true) {
return;
}
Events.OnCollide((e) => { Events.OnCollide((e) => {
// If we're diving and we hit the player, game over! // If we're diving and we hit the player, game over!
if (e.Settled && state === states.diving && e.Actor.IsPlayer()) { if (e.Settled && state === states.diving && e.Actor.IsPlayer()) {
@ -81,6 +86,11 @@ function main() {
} }
sampleTick++; sampleTick++;
// Play the bird flap sound if we are on screen.
if (Self.IsOnScreen()) {
Sound.Play("bird-fly.mp3");
}
// Are we diving? // Are we diving?
if (state === states.diving) { if (state === states.diving) {
Vy = speed Vy = speed
@ -161,6 +171,7 @@ function AI_ScanForPlayer() {
scanY += stepY; scanY += stepY;
for (let actor of Actors.At(Point(scanX, scanY))) { for (let actor of Actors.At(Point(scanX, scanY))) {
if (actor.IsPlayer() && actor.HasGravity()) { if (actor.IsPlayer() && actor.HasGravity()) {
Sound.Play("bird-dive.mp3");
state = states.diving; state = states.diving;
return; return;
} }
@ -233,10 +244,12 @@ function player() {
if (ev.Down && ev.Right && falling) { if (ev.Down && ev.Right && falling) {
Self.StopAnimation(); Self.StopAnimation();
Self.ShowLayerNamed("dive-right"); Self.ShowLayerNamed("dive-right");
Sound.Play("bird-dive.mp3");
diving = falling; diving = falling;
} else if (ev.Down && ev.Left && falling) { } else if (ev.Down && ev.Left && falling) {
Self.StopAnimation(); Self.StopAnimation();
Self.ShowLayerNamed("dive-left"); Self.ShowLayerNamed("dive-left");
Sound.Play("bird-dive.mp3");
diving = falling; diving = falling;
} else if (ev.Right) { } else if (ev.Right) {
// Fly right. // Fly right.
@ -260,6 +273,10 @@ function player() {
diving = false; diving = false;
} }
if (!diving) {
Sound.Play("bird-fly.mp3");
}
// Player is invulnerable while diving. // Player is invulnerable while diving.
Self.SetInvulnerable(diving); Self.SetInvulnerable(diving);
}); });
@ -267,7 +284,7 @@ function player() {
Events.OnCollide((e) => { Events.OnCollide((e) => {
// If the player is diving at an enemy mob, destroy it. // If the player is diving at an enemy mob, destroy it.
if (diving && e.Settled && e.Actor.IsMobile() && !e.Actor.Invulnerable()) { if (diving && e.Settled && e.Actor.IsMobile() && !e.Actor.Invulnerable()) {
Sound.Play("crumbly-break.wav"); Sound.Play("crumbly-break.mp3");
e.Actor.Destroy(); e.Actor.Destroy();
} }
}); });

View File

@ -33,7 +33,7 @@ function main() {
} }
if (!pressed && !stickyDown) { if (!pressed && !stickyDown) {
Sound.Play("button-down.wav") Sound.Play("button-down.mp3")
Message.Publish("power", true); Message.Publish("power", true);
pressed = true; pressed = true;
} }
@ -50,7 +50,7 @@ function main() {
delete colliders[e.Actor.ID()]; delete colliders[e.Actor.ID()];
if (Object.keys(colliders).length === 0 && !stickyDown) { if (Object.keys(colliders).length === 0 && !stickyDown) {
Sound.Play("button-up.wav") Sound.Play("button-up.mp3")
Self.ShowLayer(0); Self.ShowLayer(0);
Message.Publish("power", false); Message.Publish("power", false);
timer = 0; timer = 0;

View File

@ -6,7 +6,7 @@ function main() {
if (powered && pressed) { if (powered && pressed) {
Self.ShowLayer(0); Self.ShowLayer(0);
pressed = false; pressed = false;
Sound.Play("button-up.wav") Sound.Play("button-up.mp3")
Message.Publish("power", false); Message.Publish("power", false);
Message.Publish("sticky:down", false); Message.Publish("sticky:down", false);
} }
@ -26,7 +26,7 @@ function main() {
return; return;
} }
Sound.Play("button-down.wav") Sound.Play("button-down.mp3")
Self.ShowLayer(1); Self.ShowLayer(1);
pressed = true; pressed = true;
Message.Publish("power", true); Message.Publish("power", true);

View File

@ -37,10 +37,11 @@ function main() {
// Begin the animation sequence if we're in the solid state. // Begin the animation sequence if we're in the solid state.
if (state === stateSolid) { if (state === stateSolid) {
state = stateShaking; state = stateShaking;
Sound.Play("crumbly-rumble.mp3");
Self.PlayAnimation("shake", () => { Self.PlayAnimation("shake", () => {
state = stateFalling; state = stateFalling;
Self.PlayAnimation("fall", () => { Self.PlayAnimation("fall", () => {
Sound.Play("crumbly-break.wav") Sound.Play("crumbly-break.mp3")
state = stateFallen; state = stateFallen;
Self.ShowLayerNamed("fallen"); Self.ShowLayerNamed("fallen");

View File

@ -156,7 +156,7 @@ function main() {
// Landed? // Landed?
if (point.Y === lastAltitude) { if (point.Y === lastAltitude) {
Sound.Play("crumbly-break.wav") Sound.Play("crumbly-break.mp3")
state = states.hit; state = states.hit;
Self.PlayAnimation("hit", () => { Self.PlayAnimation("hit", () => {
state = states.rising; state = states.rising;

View File

@ -50,7 +50,9 @@ function main() {
if (unlocked) { if (unlocked) {
Self.ShowLayer(enterSide < 0 ? layer.right : layer.left); Self.ShowLayer(enterSide < 0 ? layer.right : layer.left);
opened = true; opened = true;
Sound.Play("door-open.wav") if (Self.IsOnScreen()) {
Sound.Play("door-open.mp3");
}
return; return;
} }
@ -64,7 +66,9 @@ function main() {
if (e.Settled) { if (e.Settled) {
unlocked = true; unlocked = true;
Self.ShowLayer(enterSide < 0 ? layer.right : layer.left); 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 a Small Key door, consume a small key.
if (color === "small") { if (color === "small") {
@ -75,7 +79,7 @@ function main() {
}); });
Events.OnLeave((e) => { Events.OnLeave((e) => {
Self.ShowLayer(unlocked ? layer.unlocked : layer.closed); Self.ShowLayer(unlocked ? layer.unlocked : layer.closed);
// Sound.Play("door-close.wav") // Sound.Play("door-close.mp3")
// Reset collision state. // Reset collision state.
opened = false; opened = false;

View File

@ -23,13 +23,13 @@ function setPoweredState(powered) {
animating = true; animating = true;
opened = true; opened = true;
Sound.Play("electric-door.wav") Sound.Play("electric-door.mp3")
Self.PlayAnimation("open", () => { Self.PlayAnimation("open", () => {
animating = false; animating = false;
}); });
} else { } else {
animating = true; animating = true;
Sound.Play("electric-door.wav") Sound.Play("electric-door.mp3")
Self.PlayAnimation("close", () => { Self.PlayAnimation("close", () => {
opened = false; opened = false;
animating = false; animating = false;

View File

@ -23,7 +23,9 @@ function main() {
return; return;
} }
Sound.Play("item-get.wav") if (Self.IsOnScreen()) {
Sound.Play("item-get.mp3")
}
e.Actor.AddItem(Self.Filename, quantity); e.Actor.AddItem(Self.Filename, quantity);
Self.Destroy(); Self.Destroy();
} }

View File

@ -14,7 +14,9 @@ function main() {
Events.OnCollide((e) => { Events.OnCollide((e) => {
if (e.Settled) { if (e.Settled) {
if (e.Actor.HasInventory()) { if (e.Actor.HasInventory()) {
Sound.Play("item-get.wav") if (Self.IsOnScreen()) {
Sound.Play("coin-drop.mp3")
}
e.Actor.AddItem(Self.Filename, 1); e.Actor.AddItem(Self.Filename, 1);
Self.Destroy(); Self.Destroy();
} }

View File

@ -31,13 +31,13 @@ function main() {
if (e.InHitbox) { if (e.InHitbox) {
if (e.Actor.IsPlayer()) { if (e.Actor.IsPlayer()) {
// Fatal to the player. // Fatal to the player.
Sound.Play("crumbly-break.wav"); Sound.Play("cling.mp3");
FailLevel("Watch out for anvils!"); FailLevel("Watch out for anvils!");
return; return;
} }
else if (e.Actor.IsMobile() && !e.Actor.Invulnerable()) { else if (e.Actor.IsMobile() && !e.Actor.Invulnerable()) {
// Destroy mobile doodads. // Destroy mobile doodads.
Sound.Play("crumbly-break.wav"); Sound.Play("cling.mp3");
e.Actor.Destroy(); e.Actor.Destroy();
} }
} }

View File

@ -31,6 +31,7 @@ function main() {
colliding = true; colliding = true;
state = !state; state = !state;
Sound.Play(state ? "activate.mp3" : "deactivate.mp3");
Message.Broadcast("broadcast:state-change", state); Message.Broadcast("broadcast:state-change", state);
showSprite(); showSprite();

View File

@ -20,6 +20,10 @@ build:
doodad edit-doodad --tag "ms=250" reg-stall-250.doodad doodad edit-doodad --tag "ms=250" reg-stall-250.doodad
doodad install-script stall.js 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 # Power Source
doodad convert -t "Power Source" power-64.png power-source.doodad doodad convert -t "Power Source" power-64.png power-source.doodad
doodad install-script power.js power-source.doodad doodad install-script power.js power-source.doodad

BIN
regions/solid-64.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 767 B

9
regions/solid.js Normal file
View File

@ -0,0 +1,9 @@
// Solid Region
function main() {
Self.Hide();
Events.OnCollide((e) => {
// Solid to everybody - the whole canvas hitbox.
return false;
});
}

View File

@ -18,7 +18,7 @@ function main() {
} }
if (collide === false) { if (collide === false) {
Sound.Play("button-down.wav") Sound.Play("button.mp3")
state = !state; state = !state;
Message.Publish("switch:toggle", state); Message.Publish("switch:toggle", state);

View File

@ -53,11 +53,13 @@ function stealable() {
// If the player lost their items, notify them. // If the player lost their items, notify them.
if (victim.IsPlayer() && stolen > 0) { 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'); 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 the Thief IS the player, notify your earnings.
if (Self.IsPlayer() && stolen > 0) { 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); Flash("Awesome! Stole %d item%s from the %s!", parseInt(stolen), stolen === 1 ? '' : 's', e.Actor.Drawing.Doodad.Title);
} }
} }

View File

@ -52,6 +52,7 @@ function setPoweredState(powered) {
} }
animating = true; animating = true;
Sound.Play("gears.mp3");
Self.PlayAnimation("open", function () { Self.PlayAnimation("open", function () {
isOpen = true; isOpen = true;
animating = false; animating = false;
@ -63,6 +64,7 @@ function setPoweredState(powered) {
}); });
} else { } else {
animating = true; animating = true;
Sound.Play("gears.mp3");
Self.PlayAnimation("close", function () { Self.PlayAnimation("close", function () {
isOpen = false; isOpen = false;
animating = false; animating = false;

View File

@ -131,6 +131,7 @@ function main() {
// Play the open and close animation. // Play the open and close animation.
animating = true; animating = true;
Sound.Play("door-opening.mp3");
Self.PlayAnimation("open", () => { Self.PlayAnimation("open", () => {
e.Actor.Hide() e.Actor.Hide()
Self.PlayAnimation("close", () => { Self.PlayAnimation("close", () => {