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

#1 2007-07-10 13:31:09

FunkyStudios
Scratcher
Registered: 2007-07-03
Posts: 15

Changing backgrounds on a sprite?

How do I change a background when I'm on a different sprite? ITstead of having to broadcast something to tell the background to change...? Please someone help!!!


                                           Funky Studios

Last edited by FunkyStudios (2007-07-10 13:47:15)

Offline

 

#2 2007-07-10 13:47:32

FunkyStudios
Scratcher
Registered: 2007-07-03
Posts: 15

Re: Changing backgrounds on a sprite?

HELLLLLLPPPPPPPP

Offline

 

#3 2007-07-10 13:53:02

FunkyStudios
Scratcher
Registered: 2007-07-03
Posts: 15

Re: Changing backgrounds on a sprite?

.... Check the topic Here!

Offline

 

#4 2007-07-10 16:02:28

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

Re: Changing backgrounds on a sprite?

You have to use a broadcast to tell the background to change from inside of a sprite.

Paulmedwal


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

Offline

 

#5 2007-07-15 10:10:23

Greatdane
Scratcher
Registered: 2007-06-05
Posts: 1000+

Re: Changing backgrounds on a sprite?

Actually, you can use a vairable to switch backgrounds. You put in a sprite| set () to| or |change () by ( ) | and then in the background sprite there can be| forever if (vairable)= ( ) switch to background

Last edited by Greatdane (2007-07-15 10:13:14)


The future belongs to those who believe in the beauty of their dreams.
        ~ Eleanor Roosevelt

Offline

 

#6 2007-07-15 10:30:45

kevin_karplus
Scratcher
Registered: 2007-04-27
Posts: 1000+

Re: Changing backgrounds on a sprite?

Global variables and busy-wait loops can be used in place of messages, but the message mechanism is somewhat cleaner and should be more efficient if implemented correctly.  Also, the message mechanism does not require the green flag to start everything off.

I've been trying in my programs to minimize the need for green flag scripts, so that programs work correctly even if people don't hit the green flag button first.  This is not possible in all programs, but is an interesting programming challenge.

Offline

 

#7 2008-09-14 06:37:51

mariluz324
Scratcher
Registered: 2008-01-01
Posts: 2

Re: Changing backgrounds on a sprite?

Could you explain how to change the background with a different sprite step by step?

Offline

 

#8 2008-09-24 19:37:09

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

Re: Changing backgrounds on a sprite?

i need help how to change back grounds use the picture things and please help!!!!!!!!!!!

Offline

 

#9 2008-09-24 20:34:09

Paddle2See
Scratch Team
Registered: 2007-10-27
Posts: 1000+

Re: Changing backgrounds on a sprite?

nkc wrote:

i need help how to change back grounds use the picture things and please help!!!!!!!!!!!

Hey nkc,

You change the background with the "Switch To Background xxx" block which you will find in the Stage area under Looks (purple blocks).  If you want to set it up so that the background changes when something happens to a sprite somewhere, the easiest way to do it is with Broadcast messages.

Set up a script on the stage that looks like this:

Code:

When I receive some-name-you-pick
    Switch to Background another-name-you-pick

Then, whenever you want the background to change, you send a broadcast message from a script anywhere in the project:

Code:

Broadcast some-name-you-pick

You will find the "When I receive" and the "Broadcast" blocks in the Control section (gold blocks).  You make up a name for the broadcast message.   I hope that helps.  If you would like a sample project, just let me know.


http://i39.tinypic.com/2nav6o7.gif

Offline

 

Board footer