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

#1 2011-09-15 17:21:33

Babado
Scratcher
Registered: 2011-09-15
Posts: 84

If colour is touching Colour switch background.

Hey.

Im trying to make it so if colour is touching colour it will switch to background 2 and so on.

But it wont work, I try dragging it onto the background one, but it gives me a box saying Error, and my whole script goes red on the sprites <.< Anyone know what Im doing wrong?

Offline

 

#2 2011-09-15 17:30:51

KyleK7
Scratcher
Registered: 2011-06-14
Posts: 500+

Re: If colour is touching Colour switch background.

Do this:

Sprite:
[if<color[]is touching color[]>]
[broadcast [(message name)]]

Background:

[When I receive[(message name)]
[switch to background]


http://i46.tinypic.com/zwxnhh.gif

Offline

 

#3 2011-09-15 17:32:28

P-Cupcake
Scratcher
Registered: 2011-09-14
Posts: 500+

Re: If colour is touching Colour switch background.

Babado wrote:

Hey.

Im trying to make it so if colour is touching colour it will switch to background 2 and so on.

But it wont work, I try dragging it onto the background one, but it gives me a box saying Error, and my whole script goes red on the sprites <.< Anyone know what Im doing wrong?

Yes. You might want to make a sprite so that if it touches another color, it broadcasts something to the Stage so then on the Stage's script it'll change costume.

I hope this helped, and that if it didn't, someone else could explain it more clearly.

The stage can't move, BTW.  wink


http://fc09.deviantart.net/fs70/i/2010/173/5/4/Painis_Cupcake_Jr__by_PrawnBoy101.jpghttp://i39.tinypic.com/t98djc.png

Offline

 

#4 2011-09-15 17:48:13

Babado
Scratcher
Registered: 2011-09-15
Posts: 84

Re: If colour is touching Colour switch background.

That has worked perfectly  big_smile  Thanks

One other thing, The fish chomp game that comes with scratch, I tried remaking that, first I made the script the exact same, and made spirtes to go with it, and they dont move as "elegantly" as the fish in Fish Chomp don, they kind of spazz about the place, the only thing I changed at first was the Sprite.

Offline

 

#5 2011-09-15 19:35:59

Harakou
Community Moderator
Registered: 2009-10-11
Posts: 1000+

Re: If colour is touching Colour switch background.

Babado wrote:

That has worked perfectly  big_smile  Thanks

One other thing, The fish chomp game that comes with scratch, I tried remaking that, first I made the script the exact same, and made spirtes to go with it, and they dont move as "elegantly" as the fish in Fish Chomp don, they kind of spazz about the place, the only thing I changed at first was the Sprite.

It could be that the dimensions of the sprite are affecting the edge detect scripts, or perhaps the center of the spite is different enough so that it doesn't move in the same way.


http://www.blocks.scratchr.org/API.php?action=random&amp;return=image&amp;link1=http://i.imgur.com/OZn2RD3.png&amp;link2=http://i.imgur.com/duzaGTB.png&amp;link3=http://i.imgur.com/CrDGvvZ.png&amp;link4=http://i.imgur.com/POEpQyZ.png&amp;link5=http://i.imgur.com/ZKJF8ac.png

Offline

 

Board footer