Set sample pan.
-1.0
completely to the left0.0
in the middle (both sides)1.0
completely to the rightvoid onSceneCreated() { LoadSoundEffect("soundfx/explosion.mp3"); }
// position the sound on the sides if the explosion x coordinate exceeds screen boundaries void boom(vector2 explosionPos) { float pan = 0.0f; if (explosionPos.x < 0.0f) pan = -1.0f; else if (explosionPos.x > GetScreenSize().x) pan = 1.0f; SetSamplePan("soundfx/explosion.mp3", pan);
PlaySample("soundfx/explosion.mp3");
}