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

#1 2008-10-22 02:10:32

hellokitty-96
Scratcher
Registered: 2008-10-09
Posts: 15

Background change

Ok...
This will sound a bit complicated but...
I am not exactly sure what a variable is.
But! I made it so it counts how many things you have collected. (Not sure if that's what it's for but I did it)
I have about 4 sprites that need to be collected.
I think I am going to make more but for now there are only 4.
I want that when you collect all 4 sprites the background will change to a different scene.
I would appreciate if someone would plz reply soon!

Thanks!


-hellokitty-96

Last edited by hellokitty-96 (2008-10-22 02:41:18)

Offline

 

#2 2008-10-22 13:25:06

djmoomoo
Scratcher
Registered: 2007-08-31
Posts: 57

Re: Background change

OK, a variable is like a holding-tank, as it always contains a number. Example:

Score's are usually variables. Use the "change "XXX" by 1" block to make the score variable bigger  by 1. If you've used algebra in maths class, it's a bit like that.


There are 0011 types of people, those that can count in binary and those that can't.

Offline

 

#3 2008-10-22 13:52:19

jasb
Scratcher
Registered: 2007-11-10
Posts: 100+

Re: Background change

[blocks]<when green flag clicked>             <when green flag clicked>
<forever if>                                            <forever if>
<touching[ sprite1]                                <{ XXX }> = 4
<change{ XXX }by( 1)>                              <switch to background[ XXX[/blocks]

Last edited by jasb (2008-10-22 13:53:51)

Offline

 

#4 2008-10-22 13:53:16

djmoomoo
Scratcher
Registered: 2007-08-31
Posts: 57

Re: Background change

How to fix your problem.

make a variable called "Spritescollected".

Use the http://scratch.mit.edu/forums/viewtopic.php?pid=74103#req_message block to check if your player sprite has touched the "items". If it has, make that item http://scratch.mit.edu/forums/viewtopic.php?pid=74103#req_message, and increase "spritescollected by 1 (using the http://scratch.mit.edu/forums/viewtopic.php?pid=74103#req_message block).

then, in a seperate script, make a " IF "Spritescollected > 4 broadcast "Alldone"  block. The broadcast block is like a pager, so you use the "when I recieve Alldone" block in the 'background' sprite, which is linked to a "change costume" block.


All of this is quite hard to explain, so if you don't understand, add another post. If you really don't understand, try looking at some projects on the scratch website, to see how it works.


There are 0011 types of people, those that can count in binary and those that can't.

Offline

 

Board footer