I want to have a student type a word such as "water". A visual model of the letter to be typed is shown on the stage (i.e., an A is shown on the stage if I want them to type an A).
I can code things so that if the student doesn't make any errors typing the letters in the right order, things go well. But what if s/he types the "t" or "e" before the "A". I can code that the "w" has to be before the A, but simply cannot figure out how to prevent errors.
Basically I want to say, "if W hasn't been typed, then don't allow the A, T, E, R sprites to run their scripts until it has." and "If W and A haven't been typed, don't allow the T,E,R sprites to run their scripts until they have; etc.
If you need to see the project to answer, I can share it.
Offline
Use a variable named Count that starts out at 1. Store "water" as the variable Word (or a list item if you plan to use multiple words) and whenever a letter is entered, compare the entered letter using (green operator block) item <count> of Word. If it matches, increase Count by 1 and go to the next letter.
If that sounds crazy just say so and I'll whip this up in a working project that you can tweak as needed.
Last edited by Locomule (2010-08-01 15:50:40)
Offline
You could try something like:
[blocks]
<when green flag clicked>
<wait until><key[ W ]pressed?>
(Anything else goes here etc: )
<wait until><key[ A ]pressed?>
(Anything else goes here etc: )
<wait until><key[ T ]pressed?>
(Anything else goes here etc: )
<wait until><key[ E ]pressed?>
(Anything else goes here etc: )
<wait until><key[ R ]pressed?>
(And again, anything else goes here etc: )
[/blocks]
That way, only the letter that needs to be pressed should work
Offline
06dknibbs wrote:
You could try something like:
[blocks]
<when green flag clicked>
<wait until><key[ W ]pressed?>
(Anything else goes here etc: )
<wait until><key[ A ]pressed?>
(Anything else goes here etc: )
<wait until><key[ T ]pressed?>
(Anything else goes here etc: )
<wait until><key[ E ]pressed?>
(Anything else goes here etc: )
<wait until><key[ R ]pressed?>
(And again, anything else goes here etc: )
[/blocks]
That way, only the letter that needs to be pressed should work
Yes. This should work, except if two words starts with the same thing, it might glitch up.
Offline
My project Color Search Engine is similar to what you want. See if you can adapt its scripts.
Offline
06dknibbs wrote:
You could try something like:
[blocks]
<when green flag clicked>
<wait until><key[ W ]pressed?>
(Anything else goes here etc: )
<wait until><key[ A ]pressed?>
(Anything else goes here etc: )
<wait until><key[ T ]pressed?>
(Anything else goes here etc: )
<wait until><key[ E ]pressed?>
(Anything else goes here etc: )
<wait until><key[ R ]pressed?>
(And again, anything else goes here etc: )
[/blocks]
That way, only the letter that needs to be pressed should work
Of course, you could just mash buttons with this. (Not to put down your suggestion, I'm just saying it could defeat the purpose.) But I don't see a way to fix that without manually adding in <and not(key _ pressed)> for every, single, other, key.
Last edited by Harakou (2010-08-01 21:56:53)
Offline