Let’s say I have an enemy, which hits my character and takes away health. This part works fine, but it take away too much health, as long as my character’s still stand there, or even touches it, it take away all the health. Here’s the code I’m using.
onClipEvent (enterFrame)
{
if ( this.hitTest(_root.player))
{
_root.health._xscale-=10;
}
}
The problem is, it’s only supposed to take a little bit away from it, as you can see from the code, but it takes away too much. I’ve heard of some sort of timer function, which might help, can someone explain this to me and give me some sample code(with explainations, it’s no help if I just recieve the code)?