Hope this is the write forum section
Make a new sprite which is just a dot, one dot using the paint tool in the scratch painter. Now input the following scripts. (note: when I say go to x: 123 y:123 this is just what I have put, you may be different depending on where you want the bar.
[blocks]
<when green flag clicked>
<clear>
<go to x -223 )y 160
<point in direction( 90
<set pen size to( 5
<set pen color to( green
<pen down>
<repeat( 50
<move( 2 )steps>
<end>
<pen up>
[/blocks]
This basically draws the health bar with full health. (note. you can change the x and y position, but don't change the number of steps unless you turly understand the script above and below).
[blocks]
<when I receive[ Lower health
<if><( <x position> <>> -222 )>
<point in direction( -90
<set pen color to( red
<pen down>
<repeat( 10
<move( 1 )steps>
<end>
<pen up>
<end>
[/blocks]
This is basically saying that when it recieves lower health it will turn around and draw some red onto it. This isn't complex and I am sure you can come up with ways to improve it and work out how to make your charater die when health reaches 0. It't not that hard. Happy scratching.
Last edited by messd002 (2008-01-10 12:11:40)
Offline
Using the pen to draw and erase health is a nice way to do it.
You don't need the "repeat 10; move 1 step" though—"move 10 steps" will have the same effect and be faster. Note that if you need to test the health, you can use the x-position of the health-bar sprite.
Offline