So lets say the healthbar has 11 frames of animation, but 10 frames with health, leaving the first frame (Frame 0) with none.
Now make an normal actor called enemyhp- add the animation making sure it has the correct amount of frames. And in the right order.
Then make an
Actor vairable called something like hp, so when an enemy is created it has this script:
- Code: Select all
hp=10;
Since its an actor vairable, it relates to that single actor and not all the enemies.
When an object like a bullet collides, make a script event:
Enemy > Collision > Bullet > Script:
- Code: Select all
hp-=1; //loses how much health
enemyhp.animpos=hp;
And something similar to when your attacked.
Please reply if you have any questions or if this helps!