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

#1 2008-08-12 03:59:42

jierong_mummy
Scratcher
Registered: 2008-08-11
Posts: 1

How to load new stage and sprites when button is pressed?

I'm trying to create a math quiz using Scratch for my students. When the next button is clicked, it is suppose to load a new background with a new question. How do i go abt to do it?

Offline

 

#2 2008-08-12 04:06:33

themaker123
Scratcher
Registered: 2008-07-04
Posts: 7

Re: How to load new stage and sprites when button is pressed?

ok add these blocks to the button

<when[ button ]clicked>
<broadcast[ next back ground

and on your scene add these blocks

<when I receive[  next background

<switch to background[ ---- the back ground you made

Offline

 

#3 2008-08-12 15:36:29

Zelda123
Scratcher
Registered: 2007-11-21
Posts: 1000+

Re: How to load new stage and sprites when button is pressed?

You can use a varible to say what level or question it is. On the background use: forever Switch to costume # Level.

And on the button:
When button clicked:
Change level by 1.

Offline

 

#4 2008-08-12 18:13:55

mletreat
Scratcher
Registered: 2008-05-01
Posts: 100+

Re: How to load new stage and sprites when button is pressed?

themaker123 wrote:

ok add these blocks to the button

<when[ button ]clicked>
<broadcast[ next back ground

and on your scene add these blocks

<when I receive[  next background

<switch to background[ ---- the back ground you made

Yep that sounds right...here is a little longer explanation:

When you click on your object, you can have it send a message (called a broadcast in Scratch) to another object/background that says "change your costume"

When the second object/background receives the message "change your costume" it will do that.   

(You will also need to create a 2nd background for your stage)
You will need to create a script in each.

The object being "clicked" will need a script that says:
When sprite clicked
broadcast [write in whatever you want..."change background" would be good]

The stage will need a second script that says:
When I receive [the message you wrote..."change background"]
switch to [background2]

Hope this helps!

Offline

 

#5 2008-09-05 20:34:46

nkc
Scratcher
Registered: 2008-09-05
Posts: 3

Re: How to load new stage and sprites when button is pressed?

this is no help to me

Offline

 

#6 2008-09-05 21:34:27

Bluestribute
Scratcher
Registered: 2008-01-24
Posts: 1000+

Re: How to load new stage and sprites when button is pressed?

nkc wrote:

this is no help to me

It isn't extremely clear for multiple backgrounds. lemme give it a whack.

So you are doing a quiz? Well, that would be many questions. I'll show you 10 questions. When it loads, question one will show. Now when you click the right answer, it will switch the level variable. The background ALWAYS switches to the level variable. Like this:

<switch to costume[ <{ level  }>

But instead it is Switch to Background. Now you base if a question is correct or not on what level it is. I also made one for school, kinda like Jeopardy, where you click a square. I used this account I think.


http://img247.imageshack.us/img247/1204/bluestributett4.jpg
That's my PSN ID. I know tons of COD4 glitches. Add me as your friend. Oh, and get a headset

Offline

 

Board footer