I'd like to add something in my game so there's an increased feeling of space and distance. I want to make it so that the farther away an explosion or something occurs, the less loud it is, this doesn't have to be applied to everything just big things like explosions.
I've already done this, but in a sloppy if statement ridden way. I'm just wondering if there's a better way of doing it, similar to what I just did with the hologram power icon perhaps?
Here's the code I'm using:
Explosion -> Create Actor -> Script Editor
- Code: Select all
Distance=distance(x,y, Bounding_Box.x, Bounding_Box.y);
highest_BombExplosion=20;
switch(animindex)
{
case 0:
ChangeAnimation("Event Actor", getAnimName(Bomb_E_Upgrade), NO_CHANGE);
if(Distance>=1100)
{
PlaySound2("data/Bomb_Explosion.wav", SFX_Volume/2.5, 1, 0);
}
else
{
PlaySound2("data/Bomb_Explosion.wav", SFX_Volume, 1, 0);
}
break;
// and so on
}