I'm currently creating a game engine which is now almost finished (finally). I have had very few problems and things are progressing nicely, but I need someone to help me out with a little math problem. I used to be able to do stuff like this, but my memory of such things is not so good it seems...
Anyway, it's for projectiles that have a damage radius, the code needs to make it do 100% at 0 distance and 0% at the max distance. The values that I have to work with are the Radius of the projectile, Distance of the projectile from the entity taking damage, and maximum Amount of damage, which as I said should be 100% at 0 distance and 0% at maximum distance. Currently my code does full damage all the way out to the value of Radius, I just need to have a math function that can take Radius, Distance, and Amount and return an amount that is relative to distance as I described. Thanks to whoever can help me out!
Anyway, it's for projectiles that have a damage radius, the code needs to make it do 100% at 0 distance and 0% at the max distance. The values that I have to work with are the Radius of the projectile, Distance of the projectile from the entity taking damage, and maximum Amount of damage, which as I said should be 100% at 0 distance and 0% at maximum distance. Currently my code does full damage all the way out to the value of Radius, I just need to have a math function that can take Radius, Distance, and Amount and return an amount that is relative to distance as I described. Thanks to whoever can help me out!