Letter Key Repetition

Get help using Construct 2

Post » Wed Nov 20, 2013 2:16 pm

Hello,

I have a game where I have one sprite representing all the lettered keys on the keyboard. I set animation frame to random(0,25).

The sprite is copied and pasted so there are 6 keys with the same name but different UID's.

This works fine but most of the time a letter is repeated and I don't want that.

I cannot make more key sprites as this would mean that I would have to do a lot of code for each sprite.

Any ideas?
Thanks.
B
4
S
1
Posts: 15
Reputation: 455

Post » Wed Nov 20, 2013 2:26 pm

you could save the randomed key into a Hash..

than a hash-foreach-item
here you proof if your new randomed key is given
if no -> save it into the hash
if yes -> make a new ramdom key and make the same story


i dont think that is a lot of code.
B
7
S
3
Posts: 15
Reputation: 1,455

Post » Wed Nov 20, 2013 2:27 pm

You have to save the previous animation frames (eg Array) and check at the moment you set one with a new animation frame if this key is already given.
B
15
S
6
G
6
Posts: 512
Reputation: 5,555


Return to How do I....?

Who is online

Users browsing this forum: Lordshiva1948 and 6 guests