# Self integration?

This topic is 5466 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I have a part of my game that does "non-lethal damage", which deals damage to the health depending upon what percentage the health is. The equation looks like this: c = c - A((c/m) - s) where c is the current health, m is a constant representing the max health, s is a constant scalar (which can be between 0.05 or 0.5, where lower level characters only take non-lethal damage up to 50% of their health and the highest level characters take damage until 5% life). Now at the moment I do a for loop to continuously calculate what c is after doing a bit of damage (In other words, if I want to do 100 damage, I loop through and calculate this equation 100 times with 1 for A), so that the damage is fully reduced depending on how low your health is. Now what I'm thinking is that this could be done with integrals, but I can't seem to recall (or find in my calculus books) how I would go about integrating the changing c since c is the result and also a variable. C is changing based on this equation which is based on c which is based on this equation which is... you get the point. Is it possible to do with integrals, and if so, how? Thanks for any help.

##### Share on other sites
You got a differential equation to solve : c' = - A((c/m) - s)

• ### Game Developer Survey

We are looking for qualified game developers to participate in a 10-minute online survey. Qualified participants will be offered a \$15 incentive for your time and insights. Click here to start!

• 15
• 22
• 17
• 46