Game Maker Studio: How to Create Enemy Health Bars above their heads.
Visit my anime and game site: http://mcanime1.wixsite.com/mcanime
GMX file: https://bit.ly/2LAwLju
righten: (Note): leften, upen, downen, stanen, repeat the process.
Events:
Create
Actions:
Var: Self, Variable: hp_max, Value: 100
Var: Self, Variable: hp_current, Value:100
Var: Self, Variable: hp_percent, Value: (hp_current/hp_max)*100
Events:
Step
Actions:
Var: Self, Variable: hp_percent, Value: (hp_current/hp_max)*100
Events:
bulletup
Actions:
Var: Self, Variable: hp_current, Value: -5, Relative: checked (Note:) for bulletammo2, redammoleft, redammoup, redammodown, just change the Value to -10 in the current hp, and in the Test Variable, change Value to 10.
Destroy Instance: Other
Test Variable: Self, Variable: hp_current, Value: 5, Operation: less than
Destroy Instance: Self
Events:
Draw
Actions:
Draw Sprite
Self, sprite: righten1, x:0, y:0, subimage:-1, Relative: checked
Set Color: red
Draw Rectangle: x1: -25, y1: -40, x2: -25+(hp_percent/2), y2: -50, filled: filled, Relative: checked