- Home /
Damage script is messed up, how to fix
When hit by a bullet my worm guy should spin around once and lose a body part. When both body parts are gone, he should lose on life and respawn. What actually happens is that the worm loses one body part, then if he gets hit again, he just spins around and no damage occurs. What could be the problem here? my move around script: http://pastebin.com/7MNBBvQa my health script: http://pastebin.com/myPLHiPH
Help appreciated
We can't help if you don't post your code. And if you do post code, make sure you format it with the code button.
@$$anonymous$$eltdown, thanks for the advice, but i'm a noob and I need further explaining on how to to that :P
I'd suggest searching google the difference between static class variables/methods and instantiated class variables/methods. No point in using scripts in your game if you don't understand these OO concepts :p
I'm learning so I copied the script from a tutorial. Ideally i'd need some more guidance to change this.
Answer by Meltdown · May 30, 2011 at 12:53 PM
Taking a quick look at your script my guess comes down to how you are referencing HealthControl from your movement script.
You need to create an instance of your HealthControl object, and on that object reference increase your hits.
The problem is you are setting HealthControl.HITS += 1 on a static variable, which when called again will lose its value, and reset to the initial value.
Your answer
Follow this Question
Related Questions
Damage script only works when moving 2 Answers
How to create/fix fire damage script???? 1 Answer
Damage not triggering in build 1 Answer
Damage script is screwed up...? what to do? 1 Answer
Player won't take damage... 1 Answer