GameBuilders CommunityLog in

GameBuilders - Video Game Development Community, including Resources, Forums, Marketplace & More.

descriptionsound trigger script  Emptysound 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);}

descriptionsound trigger script  EmptyRe: 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.

descriptionsound trigger script  EmptyRe: 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.]

sound trigger script  Croppe10

descriptionsound trigger script  EmptyRe: 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.]

sound trigger script  Croppe10

descriptionsound trigger script  EmptyRe: 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