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

#1 2012-03-03 12:05:09

CoolGamesCY
New Scratcher
Registered: 2012-03-03
Posts: 15

How do I make a working health variable?

Hi, I am making a game called 'Stick Wars' so I need health variables.

The variable is working fine, but when the health reaches 0 I don't know how to make the my character die though (I know how to make the character die but not with variables)

Please help me!

Offline

 

#2 2012-03-03 12:21:30

MoreGamesNow
Scratcher
Registered: 2009-10-12
Posts: 1000+

Re: How do I make a working health variable?

When I Receive[game begins]
set [health] to (5)
wait until <(health) = [0]>
die


http://images2.layoutsparks.com/1/218929/rubiks-cube-animated-rotating.gif
"Cogito ergo sum" --  I think, therefore I am

Offline

 

#3 2012-03-03 12:28:10

ImagineIt
Scratcher
Registered: 2011-02-28
Posts: 1000+

Re: How do I make a working health variable?

MoreGamesNow wrote:

When I Receive[game begins v]
set [health] to (5)
wait until <(health) = [0]>
die

Yes, but it should be:

When I Receive[game begins v]
set [health] to (5)
wait until <(health) < [1]>
die
Because health might become negative one.

Last edited by ImagineIt (2012-03-03 12:28:42)

Offline

 

#4 2012-03-03 12:28:33

joletole
Scratcher
Registered: 2011-02-20
Posts: 1000+

Re: How do I make a working health variable?

MoreGamesNow wrote:

When I Receive[game begins]
set [health] to (5)
wait until <(health) = [0]>
stop script

Offline

 

#5 2012-03-03 12:38:32

CoolGamesCY
New Scratcher
Registered: 2012-03-03
Posts: 15

Re: How do I make a working health variable?

Thanks for help

Offline

 

#6 2012-03-03 12:42:16

Greenatic
Scratcher
Registered: 2009-05-03
Posts: 1000+

Re: How do I make a working health variable?

joletole wrote:

MoreGamesNow wrote:

When I Receive[game begins]
set [health] to (5)
wait until <(health) = [0]>
stop script

No, because that will only stop that script.  I think you mean to replace this:

stop script
with this:

stop all

Offline

 

#7 2012-03-03 13:14:49

MoreGamesNow
Scratcher
Registered: 2009-10-12
Posts: 1000+

Re: How do I make a working health variable?

Greenatic wrote:

joletole wrote:

MoreGamesNow wrote:

When I Receive[game begins]
set [health] to (5)
wait until <(health) = [0]>
stop script

No, because that will only stop that script.  I think you mean to replace this:

stop script
with this:

stop all

I originally had a "die" block (basically, an abbreviation of whatever script he is going to use to kill the sprite.  I'm not sure why joletole replaced it with "stop script".


http://images2.layoutsparks.com/1/218929/rubiks-cube-animated-rotating.gif
"Cogito ergo sum" --  I think, therefore I am

Offline

 

Board footer