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

#1 2011-09-23 09:25:29

Babado
Scratcher
Registered: 2011-09-15
Posts: 84

Plyayer health

I need help with making it so that when a chracter gets 0 health, it stops the game.

I currently have

WHEN GREEN FLAG CLICKED
REPEAT UNTIL
HEALTH=0
STOP ALL

But it wont work D=

Offline

 

#2 2011-09-23 13:54:45

4lover
Scratcher
Registered: 2010-04-24
Posts: 500+

Re: Plyayer health

Well if you already have a health script then heres the script to stop the game:

<when green flag clicked><forever if><( Health <=>0  )><broadcast[ stop game
The you need to make a stage costume that says game over etc.
Script for stage: <when I receive[ stop game<switch to costume [ which ever costume says game over <stop all>


Hope this helps!

Last edited by 4lover (2011-09-23 13:57:28)


Check out this awesome new zombie-cod type of game: http://scratch.mit.edu/projects/4lover/1975649

Offline

 

#3 2011-09-23 15:44:38

henley
Scratcher
Registered: 2008-06-21
Posts: 1000+

Re: Plyayer health

Babado wrote:

I need help with making it so that when a chracter gets 0 health, it stops the game.

I currently have

WHEN GREEN FLAG CLICKED
REPEAT UNTIL
HEALTH=0
STOP ALL

But it wont work D=

Think about what that does.

It means that until the health is equal to zero, it will stop everything.

You need to use the “wait until” block.

smile


"I've worked so hard for you and you give me nothing in return. Do you need help... Or do I?"

Offline

 

#4 2011-09-23 16:08:29

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

Re: Plyayer health

henley wrote:

Babado wrote:

I need help with making it so that when a chracter gets 0 health, it stops the game.

I currently have

WHEN GREEN FLAG CLICKED
REPEAT UNTIL
HEALTH=0
STOP ALL

But it wont work D=

Think about what that does.

It means that until the health is equal to zero, it will stop everything.

You need to use the “wait until” block.

smile

Yeah.  Best way:

When Green Flag Clicked:
wait until <(health) = 0>.
stop all.

Offline

 

#5 2011-09-23 17:00:35

Solarbuddy
Scratcher
Registered: 2009-04-14
Posts: 500+

Re: Plyayer health

do <0 because the < is less than and anything less than 0.


http://bit.ly/Vn3zid
                  View my latest project

Offline

 

Board footer