interpolating a sound with the actors x position
digitalzero
Member, BASIC Posts: 639
so i want to know how to make the sound which is a looping sound get louder as the character gets closer to the actor and starts to get more quiet as the character gets further away from the actor
Comments
I think you'd have to use the magnitude function to keep track of the distance between the two actors and then increase or decrease the volume as needed.
http://jamie-cross.net/posts/ ✮ Udemy: Introduction to Mobile Games Development ✮ Learn Mobile Game Development in One Day Using Gamesalad ✮ My Patreon Page
There is the option of Positional Sound but that doesn't account for actors positions away from each other. I believe that adjusts volume level based on the cameras distance from the sound.
http://jamie-cross.net/posts/ ✮ Udemy: Introduction to Mobile Games Development ✮ Learn Mobile Game Development in One Day Using Gamesalad ✮ My Patreon Page
yea, track the magnitude from the character to the actor. It will output the number of pixels away.
Audio is calculated on a 0 to 1 scale, 1 being loudest.
So depending on how far away you want the volume to work, maybe have something like
constrain game.sound to 1-magnitude(actorX-characterX,actorY,characterY)/500
so if you actor was 400 pixels away your audio would be .2,
if your actor was 100 pixels away, your audio would be .8
Send and Receive Data using your own Server Tutorial! | Vote for A Long Way Home on Steam Greenlight! | Ten Years Left
WOW this forum is the best and the community is awesome! i really appreciate it all from you guys! you all are helping me make this game awesome!!!!!!!!!