Comparing Private variables of different sprites

This forum is currently in read-only mode.
From the Asset Store
Adjusting the game screen for different resolutions (Letterbox scale)
  • Is there a way to compare private variables of different objects? if there is can somebody please tell me because it would reduce the amount of events I'm using by a lot.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Not sure what you mean here, do you mean to compare private variables of two object instances of the same base object? or between two different objects entirely?

  • of two different sprites entirely

  • Hmm, should be able to do Sprite1.value('Value 1') Is Equal To Sprite2.value('Value2') from a System Compare condition.

  • Is there a way to compare private variables of different objects?There are several ways of doing this. Without knowing the purpose it is hard to tell which one is the preferable.

    (objA and objB being two different sprites with a pv named "someVar" each)

    1) You can use the "compare"-conditon of the system object:

    + System: objA ('someVar') Equal to objB ('someVar')

    This will result to true or false but will not pick anything.

    2) You may also use the "evaluate"-condition of the system object:

    + System: objA ('someVar') = objB ('someVar')

    An evaluation is a calculation that results to either true or false (e.g. objA('someVar') + 12 > objB('someVar') * 2). This will also pick nothing.

    3) Another way is using the sprite's "pick by comparison"-condition:

    + objA: Pick by 'someVar' Equal to objB ('someVar')

    This will pick all instances of objA that match the pv of the first instance of objB

    4) Also, there's a "pick by evaluation"-condition:

    + objA: Pick by 'someVar' = objB ('someVar')

    Again, this picks all instances of objA that match the pv of the first instance of objB

    Use the evaluation conditions whenever the comparison is more complex than a simple compare.

    Have a look at the wiki, it is full of descriptions, tricks, and other useful stuff :)

  • Thanks :)

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