How do I compare values and if not equals pick highest?

0 favourites
  • 4 posts
From the Asset Store
More, less or equal
$15.30 USD
15% off
The game will give you a dog that appeared and you must say if he appeared more, less or equal.
  • I need to check the values of the same variable in the 25 instances and get the instance that have the highest value if it is unique or request that the user changes the equal values. I believe I will need to use the "Sprite>Pick highest" event but I don't know how to build it.

  • I'd create a Function that fills an Array with all the values your looking at and then pick the highest value in the array.

  • Local variable TheHighest

    Sprite>Pick highest

    _____Set highest to the highest instance value

    Sub ____ System > pick all

    _________ Sprite > Compare instance variable =? TheHighest

    _________System > compare 2 values ... Sprite.PickedCount =? 1

    ___________________actions run if there is only 1 TheHighest

    _________Else

    ___________________actions run if there is more then 1 TheHighest

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Local variable TheHighest

    Sprite>Pick highest

    _____Set highest to the highest instance value

    Sub ____ System > pick all

    _________ Sprite > Compare instance variable =? TheHighest

    _________System > compare 2 values ... Sprite.PickedCount =? 1

    ___________________actions run if there is only 1 TheHighest

    _________Else

    ___________________actions run if there is more then 1 TheHighest

    I was doing something like that but I forgot to include the "compare 2 values" condition in the same event of the two others. Thank you.

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