I'm trying to make a health system using only number sprites and hidden variables. The health starts out at 200. I have a separate sprite for the hundreds, tens and ones place (so I have a 2, a 0 and a 0) How can I make it to where the number sprites change costumes to make it look like the health is decreasing by however much I need it to?
(Without having to make one sprite with 200 costumes -___-)
I've seen this done in alot of games on scratch, but I can't find any of them. Please please please help. Thank you and have a nice day.
Offline
umm this would be verry time consuming it would be easier to have aa veriable large readout but iff you must use your current system you have to do this
[blocks]
<forever>
<if><( <{ health }> <=> 200 )>
<switch to costume[ 2
[/blocks]
you would have to do that for every number and each numeral sprite
or you could make one sprite have 200 costumes and do this
[blocks]
<forever>
<switch to costume[ <{ health }>
Last edited by slayerrobe7 (2011-10-01 20:19:08)
Offline
okay
hundreths digit:
setCostumeTo( letter ( length of health - 2) of health )
tenth:
setCostumeTo( letter ( length of health - 1) of health )
ones:
setCostumeTo( letter ( length of health ) of health )
sorry i didn't use blocks i was too lazy
Offline
nextstorm wrote:
okay
hundreths digit:
setCostumeTo( letter ( length of health - 2) of health )
tenth:
setCostumeTo( letter ( length of health - 1) of health )
ones:
setCostumeTo( letter ( length of health ) of health )
sorry i didn't use blocks i was too lazy
It didn't help me dude. It does something weird to the health (of the sprites) when the green flag is clicked. It starts off at "011" and when I decrease the variable it increases. I made sure I did everything correctly. I don't know if this will help you help me, but; my costumes for the health sprites decrease from the highest number (except the tens and ones, which start from the top at zero). So from the hundreds, my 2 starts with a 2 for the first costume, 1 for second and of course, 0 for the last. My tens starts off with a zero for the first, 9 for the second, 8 for the third, etc. and same for the ones place sprite. Now that you have all of this information, is there any way you can re-help? lol much appreciated.
Offline
I would suggest making costumes 0-9 and then have it stamp each digit on the screen.
An example: http://scratch.mit.edu/projects/Magnie/2062927
Offline