Small array question.

Get help using Construct 2

Post » Sun Aug 19, 2012 3:01 pm

Capx: https://dl.dropbox.com/u/1910765/arrayproblem.capx



Hello. I'm having a little trouble doing what I want. As you can see in the capx, everytime you left click, a number between 1 and 9 is chosen (these numbers are inside the array), and once a number is chosen, I replace that number in the array with a 0.

What I would like to do is that if after clicking, the chosen number is a 0, tell the event to keep trying until the number is not a 0. That way when you could get all the numbers from 1 to 9 in a random order without getting a 0, until there aren't any more numbers left. Any suggestions? Thanks.
B
63
S
23
G
17
Posts: 254
Reputation: 14,342

Post » Sun Aug 19, 2012 4:34 pm

How about deleting the element from the array instead of setting it to 0. So the array only contains the numbers you want.

array1-9.capx (r99)
B
54
S
28
G
18
Posts: 1,520
Reputation: 24,990

Post » Sun Aug 19, 2012 4:39 pm

Hey thanks, I didn't know you could delete a single "cell". Also thank you for simplifying the rest, I enjoy learning these things. I'll try it out on my project.
B
63
S
23
G
17
Posts: 254
Reputation: 14,342


Return to How do I....?

Who is online

Users browsing this forum: christina, Saad Swad and 7 guests