dwtiger
No problem man, glad to help
here is a capx that you can open with the c2 version r244
https://www.dropbox.com/s/otapg6806888ltg/Health%20bar%20version%20r244.capx?dl=0
now this capx is for the health bar only but it should be exactly the same process to create the hit box for the enemies.
Just in case that you cannot open the capx, the basic idea will be:
first, put the hit box in a family and lets named Hitbox and to that family add an instance Variable lets named >>BelongsTo >> plus add swell the Pin behavior to that family
second, put your enemy in a family and named example enemies and add an instance Variable lets named MyUID and another variable >> Health
Note: the tree instances Variables (BelongsTo, MyUID and Health) are variables type >> Number
Now let's do the events side: one more Note before we start >>when I say sub event means right click in the top event that we currently working on, and select >>Add>> then >>Add sub-event
let's start, the first Action will be created the hitboxes at the start of the game and Link them to their enemies
1- On the start of the Layout: >>Action :>> chose the family Hitbox >> then destroy
now sub event of this event>> For Each >> choose the family enemy >> now the Actions> goes in this line not in the top event
>>>Action: chose family enemy >> set variable >>MyUID to >> self.UID
>>>Action: system>>create "hitbox family" >>on layer (you choose)>> at> enemy.X, enemy.Y
>>>Another Action>> "hitbox family">> set Variable "BelongsTo" >> to >>enemies.UID
>>>Another Action>> "hitbox family">>Pin to enemies
Now with this, we finished the initial preparation, so how do we refer the enemies and their hitboxes?
2- Create New event: sprite10 >> On collision with >> "Hitbox family" >>Action: destroy sprite10
Sub Event of this event: >>enemies >> compare var >> MyUID >>Equal to >>hitbox family var: BelongsTo
Action: in the same line of the sub : enemies add or substract (Amount ) >>from enemies >> Health
3-Create New Event: >>Enemies family >> Health >>is equal or greater than 10
Sub Event of this event >> For Each >>enemie family>>Action Destroy
Sub event of this Sub event >> hitbox family>> var BelongsTo>> is equal to>>
Enemies Family>>var MyUID: Action >> Hitbox familie >> destroy
That's it Let me know if you have any problems, Make sure you put All the Actions in their correspondent line if is top event actions you put them at the top if is a sub event actions put them in the sub event if is for a sub sub event then the same put them there in the sub sub event other ways you will break the code