Pages: 1
Topic closed
I was just wondering how to make a health bar when i start making my video game because i am making an adventure story with pokemon (Fictional animals made by nintendo) that the player can battle with and i don't know how to make the health bars if one character loses a point or something.
P.S. some people wonder why i like pokemon and math. its because i like the myth and legends and that my ancestry comes from a country that is know to produce good math students.
[blocks]http://scratch.mit.edu/forums/post.php?fid=31#req_message[/blocks]
Offline
I see you are fairly new to Scratch, so... Welcome! If you have any questions about programming Scratch, you can post them in the All About Scratch section. This doesn't really fit here, but you won't get in trouble, it will just get moved.
Offline
You'd probably need to create lots of different costumes for the health bar, with one full, one 9/10 full, one 8/10 etc. Then put:
When green flag clicked
Forever
If 'Health'=10
Switch to costume 'Full'
End if
If 'Health'=9
Switch to costume '9/10'
End if
And then keep going down until you get to:
If 'Health'=1
Switch to costume '1/10'
End if
If 'Health'=0
Broadcast lose
End if
End forever
I hope this helped!
Offline
You can also use a variable to say how much health they have left.
Offline
Or, you could make a health bar costume and then stamp it then have another costume that goes to the front of the health bar that's thinner than it so that when you receive damage, the costume stamps and then moves over a bit.
Offline
a similar method would be to make one costume, colored green, then make a red sprite of that size at the edge. Use this scriptin the red sprite:
forever if touching monster:
change x by -1
stamp
change health by -1
if health < 1:
stop all
Offline
hey i was making a new game and i just wanted to know how to make a health bar myself
Offline
Hey guys, you can take a look of example at my latest test game, Frigate.
I've got health bars there and it's pretty slick.
http://scratch.mit.edu/projects/fg123/2187112
Offline
Topic closed
Pages: 1