c# - XNA sound effect -


i have little problem sound effect. doesn't function because when play played around 500000 times in 2 seconds. take look here:

soundeffect thunder; thunter=content.load<soundeffect>("thunder");  foreach (flash flash in flashes)    if(flash.visible==true)        if (time >1 && time <3)             thunder.play(); //now sounds bad because played lot of times.. want played once! (the sound 5 sec long) 

hmm. simple this:

foreach (var flash in flashes)    if (flash.visible && time > 1 && time < 3)    {         thunder.play();         break; // play sound once    } 

Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -