FragMate CommunityLog in

FragMate - Software and Game Developer Community, including Resources, Forums, Marketplace & More.

Share

descriptionsound trigger script

more_horiz
hey gy this is sound trigger script enjoy


function OnTriggerEnter(){

audio.Play(); }

function OnTriggerExit(){

audio.Stop();
yield WaitForSeconds (4);
Destroy(gameObject);}

descriptionRe: sound trigger script

more_horiz
This code is perfect for a jump scare because it plays the audio once only.

Also note that the number 4 in yield WaitForSeconds (4); is the length of the audio file.

descriptionRe: sound trigger script

more_horiz
I already posted the same script:

Code:

function OnTriggerEnter(){

audio.Play(); }

function OnTriggerExit(){

audio.Stop();
yield WaitForSeconds (4);
Destroy(gameObject);}


Last edited by developer23 on Thu Jun 11, 2015 3:12 pm; edited 1 time in total

_________________
Game Developer
YouTube Channel: [You must be registered and logged in to see this link.]
Website: [You must be registered and logged in to see this link.]

descriptionRe: sound trigger script

more_horiz
Why you copied me?? You put also the same time to destroy the object...

_________________
Game Developer
YouTube Channel: [You must be registered and logged in to see this link.]
Website: [You must be registered and logged in to see this link.]

descriptionRe: sound trigger script

more_horiz
dont fight its Nice Code ...... Very Happy

_________________
cyclops
Permissions in this forum:
You cannot reply to topics in this forum