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

#1 2011-10-30 15:25:29

BRusso
New Scratcher
Registered: 2011-10-27
Posts: 2

How to make the backround change when all sprites disapear

So i am making a brick breaker game and i've gotten everything except when  all the bricks are gone the backround changes to say "you win."  If you would please answer, it would be greatly appreciated.

Offline

 

#2 2011-10-30 15:48:16

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

Re: How to make the backround change when all sprites disapear

Use a broadcast.

Add the following script to each sprite:

When [broadcast] received:
|hide|

Then add to the Stage:

When [broadast] received:
|switch to [background]|

Then, when you run |broadcast [broadcast]|, all the sprites will hide and the background will change.

Offline

 

#3 2011-10-30 15:53:31

BRusso
New Scratcher
Registered: 2011-10-27
Posts: 2

Re: How to make the backround change when all sprites disapear

but i want it to be so that when the ball knocks off all the bricks the backround says you win!  do i add a wait?

Offline

 

#4 2011-10-30 16:08:10

AtomicBawm3
Scratcher
Registered: 2009-06-27
Posts: 1000+

Re: How to make the backround change when all sprites disapear

Just have it broadcast when that happens...for example, you could have it so that every time it hits a brick, it changes a variable by one...then you have the "When I receive" set to the total number of blocks.  Have the ball broadcast the variable (you might have to use a join block to do so) to set it off.


http://i50.tinypic.com/j0yw0p.jpg

Offline

 

#5 2011-10-31 10:24:02

scimonster
Community Moderator
Registered: 2010-06-13
Posts: 1000+

Re: How to make the backround change when all sprites disapear

Let me elaborate on what was said above.
Create a variable, named "bricks gone".
Insert this code after the code to hide each brick:
http://dl.dropbox.com/u/42774013/Scratch/program/brickbreaker%20winning%20script.gif

Offline

 

Board footer