Help with an expression

Get help using Construct 2

Post » Fri Feb 14, 2014 1:12 pm

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?
B
15
S
4
G
1
Posts: 286
Reputation: 1,988

Post » Fri Feb 14, 2014 4:54 pm

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
B
15
S
4
G
1
Posts: 286
Reputation: 1,988

Post » Fri Feb 14, 2014 5:04 pm

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.
ImageImageImage
B
71
S
22
G
259
Posts: 3,794
Reputation: 143,704

Post » Fri Feb 14, 2014 6:21 pm

Hmm, I didn't know that. Thanks, I'll try it with families.
B
15
S
4
G
1
Posts: 286
Reputation: 1,988


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 25 guests