this.health -= 10; // for 10 damage
// and always check that health doesn't go below 0 and when it reaches 0, you take some action
EDIT: Never mind. I had a stupid little "health = 100;" I put there a long time ago.
Now the only problem is that the health -=10 just doesn't work
(Health bar simply does not move when colliding with monster... o.o)
EDIT2: Agh! I think I got it! It doesn't detect the collision with the monster because the monster does not have the instance name of "Monster".
How do you give something an instance name if it doesn't appear until a while? (There are waves of these monsters so they do not appear for a while, and they continously come in waves)
EDIT3: YES! I solved it! Basically, I went to the monster's .as file and included the code there
Same thing with the hittest, but for the effect I did _root.Mainchar.health -=10 instead of this.health -=10