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

#1 2012-08-12 09:44:50

jminten
New Scratcher
Registered: 2012-06-28
Posts: 4

make two sprites hide at the same time

How do you make 2 sprites hide at the same time?

Offline

 

#2 2012-08-12 09:52:45

powerpoint56
Scratcher
Registered: 2012-04-19
Posts: 500+

Re: make two sprites hide at the same time

This should go in the "Help with Scripts" forum because this is a question about how to script something. I'll have it moved.  smile

I'd have one of the sprites have this script where you want them to hide:

broadcast [hide v]
hide
and the other sprite have this script:
when I receive [hide v]
hide
Hope this helps!

Last edited by powerpoint56 (2012-08-12 09:58:57)


http://i48.tinypic.com/2072ctw.gif

Offline

 

#3 2012-08-12 11:02:13

jminten
New Scratcher
Registered: 2012-06-28
Posts: 4

Re: make two sprites hide at the same time

It does help. But I'm trying to do a matching game. So, I need to make it only communicate when a match is made. This is harder than I thought it would be!

Offline

 

#4 2012-08-12 11:34:20

powerpoint56
Scratcher
Registered: 2012-04-19
Posts: 500+

Re: make two sprites hide at the same time

Ah, a matching game. Well, it depends on how a match is made. Is it made when two separate cards have the same costume? Or is it differently?


http://i48.tinypic.com/2072ctw.gif

Offline

 

#5 2012-08-12 11:40:06

ErnieParke
Scratcher
Registered: 2010-12-03
Posts: 1000+

Re: make two sprites hide at the same time

jminten wrote:

It does help. But I'm trying to do a matching game. So, I need to make it only communicate when a match is made. This is harder than I thought it would be!

Okay then. If you're using a different sprite for each card, then follow these steps.

First you'll need to add this onto whatever is figuring out whether or not you made a match.

if <(match made?) = (true)>
 broadcast [match! v]
end
Then add this to your card sprites. Just remember that you'll need to have the card's face-up costume as the second costume:

when I receive [match! v]
if <(costume #) = (2)>
 hide
end
I hope that this helps!


http://i46.tinypic.com/35ismmc.png

Offline

 

#6 2012-08-12 11:40:08

jminten
New Scratcher
Registered: 2012-06-28
Posts: 4

Re: make two sprites hide at the same time

Thanks for helping. A match is made when two separate cards have the same costume.

Offline

 

#7 2012-08-12 11:49:55

powerpoint56
Scratcher
Registered: 2012-04-19
Posts: 500+

Re: make two sprites hide at the same time

Great! For when you draw out the cards, have the player sprite do this:

if <([costume# v] of [card a v]) = ([costume# v] of [card b v])>
say [match] for (2) secs
next round
else
say [no match] for (2) secs
try again
Replace the unreal scratch blocks with the scripts you want for those actions.


http://i48.tinypic.com/2072ctw.gif

Offline

 

#8 2012-08-12 12:49:59

jminten
New Scratcher
Registered: 2012-06-28
Posts: 4

Re: make two sprites hide at the same time

Thanks! That's just it. What is the script that communicates a match  only when the two cards are showing their picture costumes?

Offline

 

#9 2012-08-12 12:52:33

powerpoint56
Scratcher
Registered: 2012-04-19
Posts: 500+

Re: make two sprites hide at the same time

Whatever you want. The two cards could hide using the broadcasting method I showed earlier, you could earn a point, or anything else.


http://i48.tinypic.com/2072ctw.gif

Offline

 

Board footer