Hello! I’m currently making my own flash game. Everything is going ok for now, but i’ve come across a problem. I want to add health regeneration things I have spikes which when touched takes 5 from your life, and i’m using the same code, but with the difference that it suppose to add 5 to your life, but it don’t. So this is the code that i’m wrote:
onClipEvent (enterFrame) {
if (this.hitTest(_root.char)) {
if (_root.health.text < 100) {
_root.health.text += 5 ;
unloadMovie(this);
}
if (_root.health.text > 100) {
_root.health.text = 100;
unloadMovie(this);
}
else if (_root.health.text == 100) {
unloadMovie(this);
}
}
}
So if for instance your health is 85 instead of adding 5 and making it 90 it adds 5 in the back and it becomes 855. What am i doing wrong?!