Example:
Click on the example above and use the arrow keys
Direct the blue square into the red obstacle to see the health indicator work.
Step. 1
Using the rectangle tool, create you base shape for the indicator.
Name this display, now copy and paste this in place, to copy select the rectangle
Press Ctrl+C and to paste in place press Ctrl+Shift+V,
Rename the new shape mask and place underneath display
Step. 2
Press Ctrl+Shift+V to paste the shape in place again, this time name it remover and give it a solid white colour. See Fig.2
Fig.2
Step. 3
Group the three shapes together as a sprite and name Health_Indicator
Select use bottom object as mask see Fig.3
Fig.3
Select the remover shape from within the sprite, and add a move action to the timeline for this shape.
Drag the move shape out to cover 200 frames, and place a stop action on frame 1, see Fig.4
Fig.4
Hint
To get a move action just double click on the first frame
Wait until the blue box appears in the frame then click and drag it to the right.
Step. 4
Highlight the remove shape until you get red anchor points displaying, see Fig.5
Fig.5
Now press the left arrow key to move the remover shape until it is covering the shape beneath see Fig.6
If you wish you can add a border to the indicator bar
To do so close the sprite up, select scene_1 choose the rectangle tool
Select the line and set colour to none. now drag out the rectangle around the indicator see Fig.7
Fig.7
That's it your Health indicator is finished and ready to linking up to a character.
Step. 8
Now create a button to test the function of the bar. Name it Test
Give it the following code
|
on (release) {
health_indicator.nextFrameAndStop(); } |
Now Press Ctrl+T to test the indicator works.






