Pick same objects with different variable?

0 favourites
  • 10 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • Hi,

    10 objetcs "card" with a variable called "id" from 1 to 10.

    How can i pick the cards have variable 2 4 and 6 so card.pickedcount = 3 ?

  • Add 3 conditions, compare instance variable = 2, compare instance variable = 4, compare instance variable = 6. Right click the event and click "Make OR block".

  • Add 3 conditions, compare instance variable = 2, compare instance variable = 4, compare instance variable = 6. Right click the event and click "Make OR block".

    Oh , its like my brain stop working.

    Thank you very much.

  • oosyrag

    Can you help me pick object in a row?

    Im trying to pick 5 cards like if i have 8 cards with a variable "1" "3" "4" "5" "6" "7" "9" "11" i want to pick cards with variable "3" "4" "5" "6" "7".

    I have 32 cards and im looking for a way to pick rows because there are a lot of compinations to do it manualy.

  • There is a system condition

    Is between values

    Test if a number is between two values (greater or equal to a lower value and less or equal to a higher value).

    You can use a variable to indicate the start and end values, like x and x+5.

  • With that way with 32 cards (numbers) i have to check all the compination for each number?

    Is there any easiest way to check If i own 5 or 4 or 3 cards that are in a row? (to check If the difference of each other is 1)

  • There are probably several ways to do this, but a straightforward approach I would try run a loop (repeated 27 times), checking if instance variable is between loopindex and loopindex+5, and using pickedcount to confirm if there were 5 picked.

  • I make some progress through your last comment and i can now check if 3 cards are in row but im still have a small problem.

    If 4 cards are in row it choose the 3 cards with the smallest variable, i need the opposite.

    Any idea?

  • Then as you run through the loop, save the last valid result (loopindex) to a variable.

    It will save the first, valid set, then check again and if there is a higher set it will overwrite the previous result.

    Do actions after your loop has completed, based on the stored value in the variable.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hello oosyrag

    Sorry for the late reply , because i only work 1 hour per some days.

    I finally manage to solve this with your help.

    Thank you very much.

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