O'Reilly logo

GameMaker Cookbook by Brandon Gardiner

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Adding sound emitters and listeners

With its updated audio engine, GameMaker has added the ability to simulate 3D sound. This doesn't mean that you have to make a 3D game to utilize it, however; you can use this feature to add depth (figurative and literal) to your 2D world. Let's take a look at some basics for creating location-dependent audio.

Getting ready

This recipe calls one sound file (I used a 13-second loop of rushing water; it is a public domain sound I downloaded from http://soundbible.com/): a player object (our listener) and emitter object. Give the player and the emitter their own sprites. Though a sprite for the latter isn't necessary, we're going to make it visible so that you have a point of reference when you test it. We'll call ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required