Making Things Noisy (aka making things into sound objects)

Did you know that any object can be a sound emitter? Here’s a code snippet:

game.setObject("my-object-id", "my-map-id", {
      sound: {
           src: "my-audio-url",
           volume: 1.0, // 0.0 to 1.0
           maxDistance: 10, // range in tiles you can hear it from
           loop: true, // if false, will play once when people enter the map, even if out of range
     }
});
3 Likes

Sorry, this is a bit of a noob question! But how do I add the code snippet to an object?

So to do this, you’re going to have to make an extension with this code snippet inside it. There are some good extension examples on [gathertown · GitHub]. (You can also use console commands to do this, although I’ve never tinkered with them personally and can’t give you advice there.)

If you’re pretty new to the world of dev (like me!), intro-to-programming-mod is a great place to start. I’ve also been going through W3Schools’s amazing Javascript tutorials to get up to speed.

Thank you so much! Super excited to dive in.

1 Like