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

#1 2011-06-17 18:50:44

Thescratch3
Scratcher
Registered: 2011-06-14
Posts: 1000+

Help with a project!

Somebody who knows how please post here and help! I need help on making this game. It's like a match game. I want when two MATCHING sprites (in the way I want it to) are clicked, and they are the same, I want it to disappear. But I can't figure out the logic for it. Please post if you know how. Please help me!! So here is it again. I want two sprites, matching sprites, to hide if they are BOTH clicked. Ok, so somebody answer that for me please giving the explanation on how to do it. Also two more answers for questions. I want if two NOT MATCHING sprites are clicked, I want them to switch to the first costume. Also the timer block isn't working! Please tell me how to use the timer block. Thanks, please answer these questions!


View my projects. Or face The scratch curse! (Get it?)
http://i56.tinypic.com/2cdk8hy.png

Offline

 

#2 2011-06-17 18:58:30

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

Re: Help with a project!

Actually, this is a pretty interesting problem!

I would define a local variable (for this sprite only) for each sprite, maybe call it Type.  And I would set each Type variable to the name of the type it is ("Apples", "Oranges", etc.)  Then, I would set up a variable called "First_Click".  I would set "First Clicked" to "empty" to start. 

Every time a sprite is clicked I would look at First_Click.  If it is empty, I would set it to the Type value for that sprite.  If it is not empty, this must be the second click so I would compare it to the value of Type for the current sprite.  If there is a match, give them a "Yay you got it", if there isn't a match, they get a "Bummer, not a match".  Either way, I would then set First_Click back to empty to get ready for the next pair of comparisons.

Here's a demo project to show what I am talking about...I ended up coding it a little differently then described above.  See the duck for the checking logic.

http://scratch.mit.edu/projects/Paddle2SeeFixIt/1867958

Last edited by Paddle2See (2011-06-17 21:40:43)


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

Offline

 

#3 2011-06-17 21:50:38

Thescratch3
Scratcher
Registered: 2011-06-14
Posts: 1000+

Re: Help with a project!

Ok thank you SO much, but I have just one question. Do you have the very first version of Scratch because I do.


View my projects. Or face The scratch curse! (Get it?)
http://i56.tinypic.com/2cdk8hy.png

Offline

 

#4 2011-06-17 22:18:07

Thescratch3
Scratcher
Registered: 2011-06-14
Posts: 1000+

Re: Help with a project!

Paddle2See wrote:

Actually, this is a pretty interesting problem!

I would define a local variable (for this sprite only) for each sprite, maybe call it Type.  And I would set each Type variable to the name of the type it is ("Apples", "Oranges", etc.)  Then, I would set up a variable called "First_Click".  I would set "First Clicked" to "empty" to start. 

Every time a sprite is clicked I would look at First_Click.  If it is empty, I would set it to the Type value for that sprite.  If it is not empty, this must be the second click so I would compare it to the value of Type for the current sprite.  If there is a match, give them a "Yay you got it", if there isn't a match, they get a "Bummer, not a match".  Either way, I would then set First_Click back to empty to get ready for the next pair of comparisons.

Here's a demo project to show what I am talking about...I ended up coding it a little differently then described above.  See the duck for the checking logic.

http://scratch.mit.edu/projects/Paddle2SeeFixIt/1867958

I know this is being kind of critical but can you define "Local variable, first click, second click, etc. I have about 8 (4 matches).


View my projects. Or face The scratch curse! (Get it?)
http://i56.tinypic.com/2cdk8hy.png

Offline

 

#5 2011-06-17 22:25:21

Thescratch3
Scratcher
Registered: 2011-06-14
Posts: 1000+

Re: Help with a project!

Thescratch3 wrote:

Paddle2See wrote:

Actually, this is a pretty interesting problem!

I would define a local variable (for this sprite only) for each sprite, maybe call it Type.  And I would set each Type variable to the name of the type it is ("Apples", "Oranges", etc.)  Then, I would set up a variable called "First_Click".  I would set "First Clicked" to "empty" to start. 

Every time a sprite is clicked I would look at First_Click.  If it is empty, I would set it to the Type value for that sprite.  If it is not empty, this must be the second click so I would compare it to the value of Type for the current sprite.  If there is a match, give them a "Yay you got it", if there isn't a match, they get a "Bummer, not a match".  Either way, I would then set First_Click back to empty to get ready for the next pair of comparisons.

Here's a demo project to show what I am talking about...I ended up coding it a little differently then described above.  See the duck for the checking logic.

http://scratch.mit.edu/projects/Paddle2SeeFixIt/1867958

I know this is being kind of critical but can you define "Local variable, first click, second click, etc. I have about 8 (4 matches).

Ok, I exactly copied your scripts (like the variables and how to make them match and all) but it isn't working. If I click one correct pair, everything hides. If I click one wrong pair everything hides! I will upload the game, and can you download it on your Scratch and see what is the problem (You are like my online teacher!).


View my projects. Or face The scratch curse! (Get it?)
http://i56.tinypic.com/2cdk8hy.png

Offline

 

#6 2011-06-17 22:33:34

Thescratch3
Scratcher
Registered: 2011-06-14
Posts: 1000+

Re: Help with a project!

The name is Agent Smith Rescue if that information is necessary.


View my projects. Or face The scratch curse! (Get it?)
http://i56.tinypic.com/2cdk8hy.png

Offline

 

#7 2011-06-18 12:21:26

Thescratch3
Scratcher
Registered: 2011-06-14
Posts: 1000+

Re: Help with a project!

PLEASE HELP ANYBODY? check out my project and see the flaw please too (Agent Smith Rescue).


View my projects. Or face The scratch curse! (Get it?)
http://i56.tinypic.com/2cdk8hy.png

Offline

 

Board footer