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

#1 2012-06-17 20:34:46

Firedrake969
Scratcher
Registered: 2011-11-24
Posts: 1000+

Health Bar

How exactly do you make a changing health bar, not just using a variable?


Click the sign.
https://s3.amazonaws.com/eterna/eterna2/logo2.png

Offline

 

#2 2012-06-17 22:15:26

AtomicBawm3
Scratcher
Registered: 2009-06-27
Posts: 1000+

Re: Health Bar

Firedrake969 wrote:

How exactly do you make a changing health bar, not just using a variable?

Depends...there are a few ways:
-pen tool
-costumes
-x/y position w/cover

The pen tool could be used like this with a health max of 100:

forever
go to x: (-230) y: (-170)
pen down
go to x: ((Health) - (230)) y: (-170)
pen up
Costumes could be used...but you should have a good amount of costumes if you want to do it with costumes.

The x/y position can be used basically in the same way that the pen tool was, except you may also want to include a sprite to cover the end so that it doesn't just move backward until it's off the screen.


http://i50.tinypic.com/j0yw0p.jpg

Offline

 

#3 2012-06-17 23:05:23

technomaniac
Scratcher
Registered: 2011-08-15
Posts: 94

Re: Health Bar

Exactly what the previous poster said, except maybe
If touching x: ---, broadcast message (out of life), and when message recieved (desired effect)

Offline

 

#4 2012-06-19 10:31:38

pipercubjl
Scratcher
Registered: 2010-05-20
Posts: 73

Re: Health Bar

I would make a red bar, than make another rectangle the color of the background. Put that cover over the red bar and make a script to move the cover depending on a variable.

Hope that helps.

PS I use many different costumes, because it looks better.


http://scratch.mit.edu/static/projects/pipercubjl/2621398_med.png  http://scratch.mit.edu/static/projects/pipercubjl/2634368_med.png
        Crypt            Pixel Lands

Offline

 

#5 2012-06-19 13:16:00

Prestige
Scratcher
Registered: 2008-12-15
Posts: 100+

Re: Health Bar

You may want to look at this project in which I used a health bar above all the units, see if it gives you some inspiration  smile


"Don't insult someone until you've walked a mile in their shoes. That way, if they don't like what you have to say, you'll be a mile away and still have their shoes  smile  "

Offline

 

Board footer