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

#1 2010-01-25 20:57:27

gooseman
Scratcher
Registered: 2009-09-04
Posts: 3

How to make lives???

I am semi-new to Scratch, I think it's really cool. But, I am having trouble with "Lives". I am making a sequel to my game, "The Adventures of Pancake Man," and I wanted lives in this one. How do I make 3 lives for Pancake Man whenever he touches the "evil syrup?" And when his lives get to 0, how do I make it game over?

Please help!!

Thank you,
gooseman

Offline

 

#2 2010-01-25 22:14:46

Chatter
Scratcher
Registered: 2009-11-29
Posts: 500+

Re: How to make lives???

Try this:

<when green flag clicked>
<forever>
<if> <touching[  Evil Syrup
<change{  Lives  }by(  -1
<end>
<end>
[/blocks]

Hope I helped!  big_smile

Last edited by Chatter (2010-01-25 22:15:21)


http://img19.imageshack.us/img19/2339/mcdonaldsjoke.gifAll your problems are like batter when you add a little Chatter, because when you have Chat, you're safe from bats.  big_smile
"And so?" - The little people in my brain|Status: Snow in April?

Offline

 

#3 2010-01-25 22:17:07

greenflash
Scratcher
Registered: 2009-05-27
Posts: 1000+

Re: How to make lives???

You need to make a variable. Go to the variables pallet and click on create new variable. Name it lives.

Now you need to add these scripts to your program:

[blocks]
<when green flag clicked>
<set{ lives }to( 3 or however many lives you have in this game
^ This resets your lives

<when green flag clicked>
<forever>
<if><touching[ evil syrup
<change{ lives }by( -1
<wait until><<  <not> <touching[ evil syrup >>
<end>
<end>
^ This makes it so each time you touch the evil syrup, you loose a life

Finally:

<when green flag clicked>
<forever>
<if><( <{ lives }> <=>0  )>
<stop all>
<end>
<end>

[/blocks]

Hope that helps!

Last edited by greenflash (2010-01-25 22:18:26)


http://i48.tinypic.com/2wrkirk.pnghttp://i46.tinypic.com/6r5zk7.pnghttp://i45.tinypic.com/2vtxr1t.png

Offline

 

Board footer