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
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/

View File

@ -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();
}
});

View File

@ -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;

View File

@ -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);

View File

@ -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");

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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();
}

View File

@ -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();
}

View File

@ -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();
}
}

View File

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

View File

@ -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

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) {
Sound.Play("button-down.wav")
Sound.Play("button.mp3")
state = !state;
Message.Publish("switch:toggle", state);

View File

@ -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);
}
}

View File

@ -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;

View File

@ -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", () => {