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

#1 2011-05-16 16:12:36

garawrules
New Scratcher
Registered: 2011-05-16
Posts: 7

Very Important! Help!

Hi, my name is garawrules and i'm using Scracth as a school programming software. I'm working on my final project which is an abc for kids. It has 3 different levels, the first one of them consists in pressing the vowel that appears on the screen... Ok, by now all is clear but today my teacher has tried it and she has said that i should make the vowels don't repeat 2 followed times, for example, letter E appears on the screen and the next letter, randomly, is letter E again... I have managed to avoid this but I only have succeeded with A and U (fix variable at random number between 2 and 5 for letter A and between 1 and 4 for letter U). But I don't know how to do it for the others 3 :S
Any help please?
I have to upload the project by wednesday night...
PD: I can't upload it because my teacher will think that is my project finished and will mark me directly... :S
Thanks

Offline

 

#2 2011-05-16 16:27:44

Kileymeister
Scratcher
Registered: 2008-04-17
Posts: 1000+

Re: Very Important! Help!

So each vowel is assigned a number (a=1, e=2...), right?
Then make a variable called LastVowel, and set it to the last vowel said (so when A is the last one, set it to 1, etc.)

When you are deciding the next vowel, do this:
http://i51.tinypic.com/e9xjcm.gif
There will possibly be a delay when deciding the next vowel, but that will usually last only one or two frames, which will be an imperceptible delay.

Sorry, it's a bit tricky to make this sound clear without seeing your script, I hope you understand.

Last edited by Kileymeister (2011-05-16 16:29:19)


I'm back, and showcasing two new* projects!  Click left or right on the image below to see!
http://img109.imageshack.us/img109/7905/part1l.pnghttp://img859.imageshack.us/img859/6417/part2bf.png

Offline

 

#3 2011-05-16 17:39:37

garawrules
New Scratcher
Registered: 2011-05-16
Posts: 7

Re: Very Important! Help!

<repeat( Oh sorry I didn't notice those little squares on the bottom of the page...

My project works this way:

Background programmes:

<when I receive[ play1]
<repeat(10)
<set{ click }to(0)
<set{luck  }to(<pick random(1  )to( 5)
<broadcast[ play2]
<wait until><( <{correct  }> <=>1  )>
<set{ correct }to( 0
<end>


Vowel programmes (eg: letter a)
<when I receive[ play2]
<if><< <( <{luck  }> <=>1  )> <and><( <{correct  }> <=> 0 )>  >>
<set{click  }to( 1
<go to x sad 0  )y sad 0
<show>
<repeat until><key[a  ]pressed?>
<end>
<hide>
<set{correct  }to( 1
<end>

Hope you understand

Offline

 

#4 2011-05-16 18:34:48

Kileymeister
Scratcher
Registered: 2008-04-17
Posts: 1000+

Re: Very Important! Help!

Ok, make a variable called LastVowel and make these changes (pointed out by the comments):
Background Script:
http://i54.tinypic.com/24bvqc2.gif

Vowel Script:
http://i54.tinypic.com/sxkuar.gif

Last edited by Kileymeister (2011-05-16 18:35:25)


I'm back, and showcasing two new* projects!  Click left or right on the image below to see!
http://img109.imageshack.us/img109/7905/part1l.pnghttp://img859.imageshack.us/img859/6417/part2bf.png

Offline

 

#5 2011-05-17 03:03:00

garawrules
New Scratcher
Registered: 2011-05-16
Posts: 7

Re: Very Important! Help!

It works!! Thank you so much  smile

Offline

 

#6 2011-05-17 14:14:54

Magnie
Scratcher
Registered: 2007-12-12
Posts: 1000+

Re: Very Important! Help!

I would also like to add the suggestion of the <wait until> block which can shrink the size of the code so: <wait until < key [ a ] pressed? > > might be useful in the future.

Last edited by Magnie (2011-05-17 14:15:23)

Offline

 

Board footer