The Daily Click ::. Forums ::. Klik Coding Help ::. Sound Effects
 

Post Reply  Post Oekaki 
 

Posted By Message

Smirnoff



Registered
  14/05/2009
Points
  356

VIP MemberI am an April Fool
23rd June, 2009 at 23:21:44 -

I know nothing of implementing sound effects to only appear in a certain part of a level. Also having the sounds increase and decrease in volume as they get closer or farther away from the player's position. How would one accomplish this?

 
Image

Rob Rule

Rusten Crating

Registered
  22/12/2007
Points
  532
23rd June, 2009 at 23:34:53 -

There's a good article on this very subject. Got a clickteam forums account?

http://www.clickteam.com/epicenter/ubbthreads.php?ubb=showflat&Number=92782#Post92782

 
It'll all blow over.

OMC

What a goofball

Registered
  21/05/2007
Points
  3516

KlikCast Musician! Guy with a HatSomewhat CrazyARGH SignLikes TDCHas Donated, Thank You!Retired Admin
23rd June, 2009 at 23:37:01 -

Well to limit a sound to only one part of a level is rather intuitive... check if the character is in a certain zone or if certain conditions are met.

I haven't done this, but assuming the volume level is 0-100 you could do this...

Player is within set amount (~A~) of pixels of sound emitter:

Set sample volume to 100 - ((Abs({X Position of player} - {X position of thing making sounds})) / ~A~)*100

Where ~A~ is the farthest you want them to be able to hear the sound from.

I'm not sure if that will work, I may have messed something up along the way. If I did Muz will come along and correct it.

Also, you may want to use the distance formula instead of only the X distance.

The square root of all of this: [(X(player) - X(object))^2] + [Y(Player) - Y(object)^2]

Confusing, I know.

EDIT: Well poocicles, looks like I was beat to it.

Edited by OMC

 

  		
  		

Ricky

loves Left For Dead 2

Registered
  28/12/2006
Points
  4075

Has Donated, Thank You!Game of the Week WinnerVIP MemberWii OwnerHero of TimeGOTM Winner! - November 2009I am an April Fool
24th June, 2009 at 00:24:38 -

I have a game i'm working on that does that, I'll send it you the source if you like

*here's, the source if you want to see a working example, It's under the speaker section in the events)
http://rickygames.googlepages.com/source.zip

Edited by Ricky

 
-

Smirnoff



Registered
  14/05/2009
Points
  356

VIP MemberI am an April Fool
24th June, 2009 at 19:12:43 -

Thank you for your help. It will be noted.

 
Image
   

Post Reply



 



Advertisement

Worth A Click