Remove lowest value from an array

0 favourites
  • 3 posts
From the Asset Store
Supports 1D, 2D, 3D arrays. Import and export arrays in JSON format
  • 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!

    dropbox.com/s/b5h6kpklxs8macc/Min_value_in_array.capx

    Thankyou!

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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.

  • 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.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)