# Random letter, Picking the right one.

For questions about using Classic.

### » Tue Dec 06, 2011 12:55 pm

Hi all

Ive browsed the forum and couldnt find anything that could help me.

Im trying to do this.

On a screen we see 3 randomly generated letters and only one of them is the right one, that you have to pick. How do you set that up. Do you use if loops?

Im only after the generation and pick function. Ive done all the visual and showing letters part. But they only appear randomly. And i want to make sure that only one is the right one.

Omnige2011-12-06 12:56:10
B
3
G
1
Posts: 7
Reputation: 489

### » Tue Dec 06, 2011 6:10 pm

Create only two random letters, + the letter that is the right one.
Are these letters you want to create from a text object, or sprites?
Can you post an example cap of what you're trying to do?
B
6
S
1
G
1
Posts: 69
Reputation: 1,019

### » Wed Dec 07, 2011 7:05 am

My cap isnt that well build up, im kinda messing around to learn Scirra.

But imagine this:

A "right" letter is picked at the beginning which is secret "S"

you have 3 positions                          1     2     3

and i want to generate 3 random letters       X     S     E

but only one, "S" is the right letter.
So it also has to random place at one of the 3 positions.

Am i making my self clear enough or am i messing it up?

Omnige2011-12-07 07:06:25
B
3
G
1
Posts: 7
Reputation: 489

### » Wed Dec 07, 2011 3:39 pm

After creating three different random letters, check if the correct letter is already there. If it isn't, pick one letter at random, make it spawn the right letter, and then destroy that letter.
Do you want me to post an example cap?shadowlord2011-12-07 15:41:06
B
6
S
1
G
1
Posts: 69
Reputation: 1,019

### » Sat Dec 10, 2011 12:27 pm

It sounds like a good and logical way to do it.

It would be great if you had an example cap. Im still trying to figure out how to do if loops and logics like that in scirra.

Thanks.
B
3
G
1
Posts: 7
Reputation: 489

### » Sat Dec 10, 2011 2:23 pm

One of various methods:

distributingletters.cap
B
24
S
8
G
10
Posts: 1,821
Reputation: 8,289

### » Sat Dec 10, 2011 7:16 pm

Wow brilliant and in so few events. Im gonna go study it closer. Thanks that is exactly what i had in mind.

Thanks. :)

B
3
G
1
Posts: 7
Reputation: 489

Return to Help & Support using Construct Classic

### Who is online

Users browsing this forum: No registered users and 1 guest