Remove lowest value from an array

Get help using Construct 2

Post » Wed Jul 10, 2013 10:53 am

Hi all,
I've been banging my head against the wall again trying to figure something out.

I'm generating 8 random numbers in an array (From 0 to 7)
Then setting the frames of 8 instances of the same sprite to the generated numbers.

What I want to do is be able to click the frames in sequence (From 0 to 7). If that makes sense.

I can get the numbers generated, and using a Touch event work out which is the lowest frame number being displayed. But I can't get any further.

This capx will illustrate the issue - its hard to explain in words!
Any help or pointers on which way to go would be massively appreciated!

https://www.dropbox.com/s/b5h6kpklxs8macc/Min_value_in_array.capx

Thankyou!
B
4
S
1
Posts: 12
Reputation: 985

Post » Wed Jul 10, 2013 12:42 pm

hello @benadamswoo

If I understand right, you want the player to click all the sprites in order, switching them to frame 8 if the player clicked the right one (the lowest in the array).
I would change a lot in your capx to make it more flexible, but to just solve the current problem, the simplest way would be to rewrite the value of RND.At(clickedSprite). If you put, let's say 100, inside, it won't be the lowest one anymore, and will let other sprites get clicked then.
B
17
S
8
G
4
Posts: 461
Reputation: 6,077

Post » Thu Jul 11, 2013 9:18 am

Thanks guizmus. It's sorted now.

Out of interest, do you time to briefly explain what you would change in this? This little bit forms part of a core mechanic to a game I'm making at the moment.
B
4
S
1
Posts: 12
Reputation: 985


Return to How do I....?

Who is online

Users browsing this forum: just2pale and 5 guests