How do I pick sprites based on an instance variable being x or y?

  • Hi,

    Is it possible to use some form of or operator when picking sprites by an instance variable?

    I'm building a card game, and on the deckbuilder screen I want to display the cards that are available to be selected in a grid formation on the screen. I have a function that does this using a for each loop, and an equation using the loopindex to space them out properly, but for this to work properly, I need to have narrowed them down the cards available to the player based on previous selection (stored as a global variable).

    Basically I want to create an expression that says where instance variable = 0 or instance variable = 3 then pick all of those sprites.

    If anyone can tell me if this is possible, and the best way of doing it would be great, thanks!

  • Sprite > compare instance variable = 3 narrows the picking to all sprites where that is true

  • Thanks lions_, but I want to select all the sprites where the variable equals 0 or 3, not just one or the other.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Oh right, you add the 2 conditions there and right click make OR block

  • Ah man, thank you so much! I've been puzzling over that for a while assuming it would be something in an expression, didn't think about checking the right click options. I knew there had to be a way to do it!

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