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

#1 2012-03-13 14:31:19

gamesman12
Scratcher
Registered: 2012-03-13
Posts: 67

health bar?

Hello I am very new to scratch and the forums.
I am very sorry if this has been asked before but I have been searching on the forums and other projects for a long time and they just made me even more confused.
My game is basically one character killing other creatures.
I want to know an easy way to make a health bar that (preferable) follows the enemy around as it moves. That will decrease by a different amount depending on what type of bullet the 'hero' character uses on it. sorry if its confusing but any ideas?
Also I have had to start my game from the start TWICE now because is said the key cannot be found file corrupt. I know how it happened just wondering if there's any way to fix it.
thank you for reading and if anyone has any suggestions then please comment.

Offline

 

#2 2012-03-13 18:37:06

IlovePie123456
New Scratcher
Registered: 2012-03-06
Posts: 6

Re: health bar?

just make a sprite of the health bar and set it to forever go to the enemies

Offline

 

#3 2012-03-13 18:42:44

wjack2010
Scratcher
Registered: 2010-06-28
Posts: 100+

Re: health bar?

See here http://scratch.mit.edu/forums/viewtopic.php?id=91389

Offline

 

#4 2012-03-13 20:52:10

turkey3
Scratcher
Registered: 2011-12-04
Posts: 500+

Re: health bar?

You can make the health bar part of the sprite, so when you make a character just put a Healthbar above it. Then you make multiple costumes and ha e the sprite switch costumes when it gets hit. If its something stronger you can change its costume twice.

Offline

 

#5 2012-03-14 11:50:34

gamesman12
Scratcher
Registered: 2012-03-13
Posts: 67

Re: health bar?

thankyou everyone for your help. I had sort of done what you said turkey3 but i had done it allot more complicated resulting in about 40 different scripts just for damage i have now changed it to your simpler method thank you.

Offline

 

#6 2012-03-14 17:36:49

Paddle2See
Scratch Team
Registered: 2007-10-27
Posts: 1000+

Re: health bar?

Here's a gallery of health bar projects that you might find helpful

http://scratch.mit.edu/galleries/view/71750


http://i39.tinypic.com/2nav6o7.gif

Offline

 

#7 2012-03-14 20:36:00

Haiming
Scratcher
Registered: 2011-08-20
Posts: 1000+

Re: health bar?

Ok. You make a variable, then, add a health bar over the enemy's head. The script would look like this:

when gf clicked
forever
go to Enemy 1
change y by 50
Whenever the bullet touches the enemy, the enemy would lose health points from the variable. Read the scripts in Street War for more details.

BTW, how do you make the green flag hat block???

Last edited by Haiming (2012-03-14 20:57:12)

Offline

 

#8 2012-03-14 21:53:29

TheAmaterasu
New Scratcher
Registered: 2012-03-13
Posts: 42

Re: health bar?

probably make a variable. If you say like: forever, if touching sprite: Arrow/bullet, change variable: Health by -1.  Hope that helps!  big_smile

Offline

 

#9 2012-03-16 16:20:38

gamesman12
Scratcher
Registered: 2012-03-13
Posts: 67

Re: health bar?

Haiming the script that you suggested seem to just cause the health bar to go the the top of the enemy and then flash around a bit not sure why though. I think i am just going to make a health bar with different costumes and use . forever if lighting is touching enemy1 change costume.
and so on...
also could i just upload my game then take it down after so people can suggest how to improve it?

Offline

 

#10 2012-03-18 12:13:07

MrScoop
Scratcher
Registered: 2010-12-17
Posts: 100+

Re: health bar?

Sorry if this fails, but here goes  tongue

when gf clicked
forever
set x to [x position of npc]
set y to [y position of npc] + [50]
end
...after lots and lots of editing, that works (kinda), so I think you get the picture.

Last edited by MrScoop (2012-03-18 12:20:51)

Offline

 

#11 2012-03-18 16:34:47

art-on-black
Scratcher
Registered: 2011-08-15
Posts: 20

Re: health bar?

I programmed a health bar in my Skydiving game. Its is different than these:

http://scratch.mit.edu/projects/art-on-black/2041499

I used a seperate sprite that stamped black on a part of the background that was a health bar.
Download it to see what I mean.

Offline

 

Board footer