This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2011-11-23 19:17:41

MathMaster101
Scratcher
Registered: 2011-10-29
Posts: 100+

how to make health bar when making a video game on scratch?

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]


https://sphotos.xx.fbcdn.net/hphotos-snc6/c39.0.403.403/p403x403/196165_191956434263692_1014187386_n.jpg

Offline

 

#2 2011-11-23 20:11:05

mattb777
Scratcher
Registered: 2011-07-15
Posts: 1000+

Re: how to make health bar when making a video game on scratch?

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.  wink


I'm back  big_smile

Offline

 

#3 2011-11-24 03:00:42

RedRocker227
Scratcher
Registered: 2011-10-26
Posts: 1000+

Re: how to make health bar when making a video game on scratch?

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!  wink


Why

Offline

 

#4 2011-11-24 04:33:16

scimonster
Community Moderator
Registered: 2010-06-13
Posts: 1000+

Re: how to make health bar when making a video game on scratch?

You can also use a variable to say how much health they have left.  wink

Offline

 

#5 2011-11-24 07:44:23

maxdoss
Scratcher
Registered: 2010-07-27
Posts: 1000+

Re: how to make health bar when making a video game on scratch?

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.


It's my birthday. Deal with it.

Offline

 

#6 2011-11-24 10:07:43

samtwheels
Scratcher
Registered: 2011-03-20
Posts: 1000+

Re: how to make health bar when making a video game on scratch?

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

 

#7 2011-12-14 22:21:17

animespinner
New Scratcher
Registered: 2011-12-13
Posts: 1

Re: how to make health bar when making a video game on scratch?

hey i was making a new game and i just  wanted to know how to make a health bar myself

Offline

 

#8 2011-12-14 23:54:09

locker99
Scratcher
Registered: 2010-04-25
Posts: 42

Re: how to make health bar when making a video game on scratch?

Use variables or create a list.

[link removed by moderator - please don't spam]

Last edited by Paddle2See (2011-12-15 05:16:38)


The locker99 Scratch Awards... Be prepared!
http://scratch.mit.edu/static/projects/locker99/1145702_sm.png

Offline

 

#9 2011-12-14 23:58:29

fg123
Scratcher
Registered: 2008-11-13
Posts: 1000+

Re: how to make health bar when making a video game on scratch?

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


Hai.

Offline

 

Board footer