I have a line of code that doesnt seem to want to work. as far as i know, the code determines if the event actor (in this case a bullet) is less than 350 pixels away from the player, it will play the sound. If its greater, then it gets destroyed. But. it seems to still trigger the sound, despite being well over the 350 pixel marker.
Any ideas how i can fix it up?
heres the code
- Code: Select all
if(distance(x, y,player.x, y) < 350)
{
PlaySound2("data/bullet hit tank.wav", 1.000000, 1, 0.000000);
}
else if(distance(x, y, player.x, y) > 350)
{
DestroyActor("Event Actor");
}