Glutch Glutch - 4 years ago 1148
Swift Question

SKAudioNode play sound once

I can't seem to find much information about SKAudioNode. How do i play a sound only once? I do not want to repeat the sound.

What i am trying to accomplish is to play a short laser sound each time a bullet spawns, in spritekit.

Answer Source

if you are trying to do sound effects, you use SKAction.playSoundFileNamed(...) on the sprite that is creating the effect. SKAudioNode is more for having music playing in your game


//we have ship as an SKSpriteNode

//lets fire laser

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download