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

#1 2009-09-10 01:15:17

JaredxD
Scratcher
Registered: 2009-09-10
Posts: 100+

How do I make my background change when a sprite touches something?

Hey fellow Scratchers, I am just wondering how do I make my background change when a Sprite runs into something? (e.g, it's a maze and I get to the finish, and I wanna make another level to it).

Thanks for your help,

Jared.

Offline

 

#2 2009-09-10 02:01:51

Chrischb
Scratcher
Registered: 2008-07-24
Posts: 1000+

Re: How do I make my background change when a sprite touches something?

Tell the sprite this,

Code:

When Green Flag Clicked
forever
   if touching color [ ]
      broadcast [Broadcast Name]

An alternative is this...

Code:

...
forever
   if touching [Any Sprite]
...

Hope that helps!

Last edited by Chrischb (2009-09-10 02:02:20)


I fall: It's a tragedy. You fall: It's comedy.
Hmph enjoy your fall - I get a lovely spring... without pans of new leaves.

Offline

 

#3 2009-09-10 02:46:44

JaredxD
Scratcher
Registered: 2009-09-10
Posts: 100+

Re: How do I make my background change when a sprite touches something?

Sorry, bit noobish here, what do ya's mean by broadcast?

Offline

 

#4 2009-09-10 06:52:37

JaredxD
Scratcher
Registered: 2009-09-10
Posts: 100+

Re: How do I make my background change when a sprite touches something?

Please help =]

Offline

 

#5 2009-09-10 07:27:34

demosthenes
Retired Community Moderator
Registered: 2008-02-19
Posts: 1000+

Re: How do I make my background change when a sprite touches something?

Broadcast's are in the control tab of the scripts,
they look like this [blocks]
<broadcast[ Watever ]
[/blocks]


I've taken a long hiatus, but I still visit sometimes. Give me some time to answer any messages you post on my projects!

Offline

 

#6 2009-09-11 01:36:09

JaredxD
Scratcher
Registered: 2009-09-10
Posts: 100+

Re: How do I make my background change when a sprite touches something?

Awesome, cheers folks =]

Offline

 

#7 2009-09-11 01:53:41

JaredxD
Scratcher
Registered: 2009-09-10
Posts: 100+

Re: How do I make my background change when a sprite touches something?

Ok, I've got that working fine and all now, just one more problem, when I run into my block thingy that changes the background, it goes haywire and flashes really fast through the two backgrounds I have worked on so far, and when I come of the block, it sometimes can be on the same background. Ideas?

Offline

 

#8 2009-09-11 02:07:25

BlueFlame
Scratcher
Registered: 2008-08-17
Posts: 100+

Re: How do I make my background change when a sprite touches something?

Hehe... OK. Scratch is all about playing around and seeing what works. You'll get better at this the more you work on it.

See the forever block? That means that your costume will change everytime the sprite touches the object. In Scratch, the sprite, in some cases, the sprite can touch the object for long enough to have the action performed more than once. In your case, it's the scene change. To stop this, I would insert a 'Stop Script' block directly beneath the 'broadcast' block. This will make sure the action only happens once.

Hope that helps.  big_smile
Just call out if you've got anymore problems.

- BlueFlame


Scape - The mindbending puzzle by coolstuff  big_smile

Offline

 

#9 2009-09-11 03:35:02

JaredxD
Scratcher
Registered: 2009-09-10
Posts: 100+

Re: How do I make my background change when a sprite touches something?

Thanks heaps Flame, works great now, you've been a great help  smile

Offline

 

#10 2009-09-18 01:14:53

megaman9
Scratcher
Registered: 2009-09-18
Posts: 1

Re: How do I make my background change when a sprite touches something?

i wont to nowe how to make a sprite move.

Offline

 

Board footer