Variable comparison

Get help using Construct 2

Post » Mon Feb 18, 2013 8:47 pm

Hi All,

I have a family of sprites with a local variable "colour". I wanted to compare this variable, so I'm currently using system condition "compare two variable", which is working well.

So my current event looks like this:

sprite.colour = sprite.colour

    -> (sub event) enter while loop.

But now I to add a check against two specific colours in the family. Can anyone tell me how I could write my event to include this.

So something like this:

sprite.colour = sprite.colour

OR

sprite.colour = "blue" & sprite.colour = "green"

    -> (sub event) enter while loop.


Thanks in advance for any advice you can offer.
jambo2013-02-19 08:47:09
B
10
S
2
G
1
Posts: 11
Reputation: 859

Post » Tue Feb 19, 2013 9:48 am

Does anyone know if this is possible. I've looked through the conditions but can't seem to find anything useful.

I want to write something like this:

sprite.colour = sprite.colour

OR

sprite.colour = "blue" & sprite.colour = "green"

    -> (sub event) enter while loop.


Any ideas, thanks.
B
10
S
2
G
1
Posts: 11
Reputation: 859

Post » Tue Feb 19, 2013 10:17 am

Sounds like you would like to do something kinda like this.

Instead of trapping the health variable, you'd want to trap the colour variable into the local variables and test.

Once I get some sleep, I'll write up a full tutorial on this, since it seems to be something that's been coming up a lot.
B
26
S
8
G
3
Posts: 210
Reputation: 5,973

Post » Tue Feb 19, 2013 10:56 am

Thanks so much @theubie, your a star!

I'll take a look at your link, and if I don't have any luck figuring it out myself, I'll keep an eye open for your tutorial.
B
10
S
2
G
1
Posts: 11
Reputation: 859


Return to How do I....?

Who is online

Users browsing this forum: davides, Vallar, Walessio and 24 guests