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

#1 2007-08-23 22:05:48

fbboi999
Scratcher
Registered: 2007-05-17
Posts: 100+

quick question

how do i make my game stop after the health reaches zero? i have health as a variable and cannot figure out how to set it to stop and say game over or whatever...

thanks

fbboi999


Check out my cool projects!
“Know thy self, know thy enemy. A thousand battles, a thousand victories.”

Offline

 

#2 2007-08-23 22:29:25

paulmedwal
Scratcher
Registered: 2007-03-09
Posts: 100+

Re: quick question

Put this script somewhere:
[blocks]
<when green flag clicked>
<forever if> <( health <=> 0 )>
<broadcast[ gameover
<end>
[/blocks]

And then have a sprite receive "gameover" and make it do what you want when the game ends.

Paulmedwal

Last edited by paulmedwal (2007-08-23 22:32:37)


clutter.scratch.mit.edu Visit the Clutter site to create multi-scene stories and multi-level games with Scratch.

Offline

 

#3 2007-08-23 22:31:09

fbboi999
Scratcher
Registered: 2007-05-17
Posts: 100+

Re: quick question

thanks!


Check out my cool projects!
“Know thy self, know thy enemy. A thousand battles, a thousand victories.”

Offline

 

#4 2007-08-24 02:29:09

Mayhem
Scratcher
Registered: 2007-05-26
Posts: 1000+

Re: quick question

Or you can put an "If health <1" and Broadcast immediately after the script that subtracts health.


Web-spinning Spider:  http://scratch.mit.edu/projects/Mayhem/18456
3D Dungeon Adventure:  http://scratch.mit.edu/projects/Mayhem/23570
Starfighter X: http://scratch.mit.edu/projects/Mayhem/21825
Wandering Knight: http://scratch.mit.edu/projects/Mayhem/28484

Offline

 

Board footer