0 Favourites

Help with an expression

  • Hey all,

    I'm having trouble with an expression that picks different instances of the same sprite. Basically the expression looks something like:

    If TileSprite is Illuminated (boolean)

    And Tilesprite is overlapping Tilesprite at offset (0,16) or (16,0) or (-16,0) etc - covering the 9 tiles surrounding the original Tilesprite

    Then

    Set Tilesprite boolean Illuminated to True

    In other words, starting with the first Tilesprite that is Illuminated, the boolean value Illuminated "radiates" out to all surrounding Tilesprites (and then on to the ones surrounding them, etc). The problem is I don't think Construct is picking the right Tilesprite to set the boolean: the condition mentions multiple instances of Tilesprite, but I think the action is only picking the primary instance (which already had the Illuminated value!).

    I hope I've explained that well enough! I'm sure it's just a case of me not expressing it properly, could anyone please tell me how to achieve this effect?

  • To simplify this question, I guess I'm really asking how to tell Construct this:

    If Tilesprite with ValueX is overlapping TileSprite without ValueX, set second Tilesprite to ValueX

  • You can't reference two of the same object at the same time. You can do this with Families, or you could have an invisible helper sprite that you place over the illuminated one, then do your comparison against the TileSprites.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Hmm, I didn't know that. Thanks, I'll try it with families.

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