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

#1 2011-01-12 12:04:54

Dinoclor
Scratcher
Registered: 2010-06-10
Posts: 1000+

Can anyone help me with a lives system for my game?

I need a lives system for my game. I'll give credit to whoever's life system I use. If anyone knows how to do this, please reply  smile


This is a temporary signature. It will exist until I think of something witty.

Offline

 

#2 2011-01-12 12:17:23

technoguyx
Scratcher
Registered: 2008-10-18
Posts: 1000+

Re: Can anyone help me with a lives system for my game?

You can use a variable. Go to the variables one, create it and then use a script to count the lives, like this:

[blocks]<when green flag clicked>
<set{ LIVES }to( 3

<when I receive[ death
<change{ LIVES }by( -1
<if><( <{ LIVES }> <=> 0 )>
<broadcast[ GAME OVER
<end>[/blocks]

With the [broadcast [GAME OVER]] you can tell a certain sprite to do something when you lose, such as displaying a screen and then using a [stop all] block. Hope this helps (and works for you)  smile


http://getgnulinux.org/links/en/linuxliberated_4_78x116.png

Offline

 

#3 2011-01-13 16:58:56

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

Re: Can anyone help me with a lives system for my game?

I'll tweak technoguyx's.

Orange=Control
Red=Variables
RoyalBlue=Sensing
Green=Operators

[when green flag clicked]
[set [lives V] to (number of lives)]
|forever]
| || |if <touching color []>]
| || |[change lives by (-1)]_________________
| || |____________________________________]
| || |if <(lives) =[/green] (0) >]
| || |[stop all]______
| || |______________]_____________________
|________________________________________]


Wow, that was complex. That took forever. Quote this to see all my hard work!  tongue


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

Offline

 

Board footer