RP | Resource | Playing Packed Sound With AUD

Version: UPBGE 0.2x

Here is a blend-file demonstrating the playing of a packed sound file with the AUD module.
Just play the game and the packed sound should be played.

import bge, aud

sound_dict = {a.name: a.sound for a in bge.logic.getCurrentController().owner.actuators if "Gunshot" in a.name}

def main(self):
    if self.sensors["Always"].status == 2:
        if self.owner["Time"] >0: self.owner["Time"] -=1
        if self.owner["Time"] == 0:
            sfx = aud.device().play(sound_dict["Gunshot"])
            sfx.volume = 2.0
            self.owner["Time"] = DELAY_AMOUNT


UPBGE_0.2x_Play_Packed_Sound.blend (98.6 KB)