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

#1 2013-04-07 21:28:33

ltperkins
New Scratcher
Registered: 2013-04-07
Posts: 2

Mix and matching sprites

I would like to create a program where the user is asked to match a sprite to a querry.
For example, the letter "B" is shown to the user and he/she has to click all the (moving) sprites which start with the letter B (e.g., the Ball sprite, the Banana sprite.... but not the car sprite).

For this, I am thinking I would need to assign a "value" to a sprite and give points whenever the cursor is clicked on a sprite of the correct value (relative to the prompt).

Has anyone done something similar?  Any suggestions would be much appreciated.

Offline

 

#2 2013-04-07 22:31:47

Maltese_Falcon
Scratcher
Registered: 2013-03-25
Posts: 100+

Re: Mix and matching sprites

Maybe something like:
Assign a variable to each letter (A=1, b=2, etc), then:
[scratchblocks]
when bat clicked
if <(letter) = [2]
say [Good Job!] for [3] secs
else
say [You got it wrong] for [3] secs
end

Offline

 

#3 2013-04-07 22:36:07

Maltese_Falcon
Scratcher
Registered: 2013-03-25
Posts: 100+

Re: Mix and matching sprites

Maltese_Falcon wrote:

Maybe something like:
Assign a variable to each letter (A=1, b=2, etc), then:

when bat clicked
if <(letter) = [2]
say [Good Job!] for [3] secs
else
say [You got it wrong] for [3] secs
end

Messed up. Whoops!

Offline

 

#4 2013-04-07 22:39:37

Maltese_Falcon
Scratcher
Registered: 2013-03-25
Posts: 100+

Re: Mix and matching sprites

Maltese_Falcon wrote:

Maltese_Falcon wrote:

Maybe something like:
Assign a variable to each letter (A=1, b=2, etc), then:

when [bat v] clicked
if <(letter) = [2]>
say [Good Job!] for [3] secs
else
say [You got it wrong] for [3] secs
end

Messed up. Whoops!

Messed up again! Darn it!

Offline

 

#5 2013-04-08 21:40:58

ltperkins
New Scratcher
Registered: 2013-04-07
Posts: 2

Re: Mix and matching sprites

Maltese_Falcon wrote:
  Maybe something like:
  Assign a variable to each letter (A=1, b=2, etc), then....

Can you please elaborate?

I would randomly select and display letter...
How would I assign a value to each letter?  Do I need to create an array ahead of time?

I would then want randomly select a few sprites and have them move around the screen...
But then how do I setup the "when clicked...if... then" since they will be randomly selected.

Thanks for your time and thoughts.

Offline

 

#6 2013-04-09 05:03:45

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

Re: Mix and matching sprites

Yeah, you could use a local variable on the sprites, maybe called Starts_With and assign it a value using a Green Flag script.  Then, use a global variable to set what you are looking for, maybe called Looking_For.  On each sprite you then put the same script that runs when the sprite is clicked and compares Starts_With to Looking_For and does things if they match.

Just define the local variable on one sprite - as you copy the script it will create the variable automatically in the other sprites.  Good luck!


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

Offline

 

Board footer