What is this system/object param is for?

0 favourites
  • 3 posts
From the Asset Store
Welcome! I-Spy (Hidden objects) is an educational puzzle that is more than just seek-and-find activities.
  • Hi there, long time since i posted around the forums. I searched the forum but couldn't find a result cause i don't know how to call this expression, that is in Construct but never understood what does it do.

    The expression in question is this:

    object(object.anything).x

    the (object.anything) what does it do? identify a certain object? or what is it for?

    im using it as a object identifier of the same type for example:

    i have 5 buttons... all the same sprite just different instances.

    from left to right i assigned a 0 to 4 id to them as i create them in a loop at a start-up to perfectly align them.

    but as u press the button the buttons increase in width to "simulate" it's selected.

    and decrease in width to original width to show that is not selected.

    now i need to calculate the distance from the first to last button in order to perfectly align the object in center based on the gap between those buttons.

    im calculating the distance as distance(button(button.id=0).bboxright,0,button(button.id=4).bboxleft,0)

    this if the expression between the parenthesis is working as im thinking at as a identifier between objects of the same type. then it should give me the exact distance between first and last object. but ...it's short by 20% or so...

    i realize the problem is with me no understanding properly what the (object.anything) expression is for... anyone can explain to me what this thing does? i think i asked before but i forgot was a long time ago 2-4 years ago maybe. Thank you in advanced.

    P.S im looking through the manual to see if i can find it... so far no luck.

    P.P.S i solved my issue another way... but i still don't know what this expression does. If anyone can answer would help a lot.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Object(n).expression lets you pick the nth instance of am object in an expression.

    construct.net/en/make-games/manuals/construct-3/project-primitives/events/expression

    See the section on object expressions.

    Iirc, this is special in that it can reference the values of an object that isn't currently picked by event conditions.

    There is nothing special about object.anything, as long as object.anything is any expression that returns a number that represents the object instance (n, or iid) you're trying to get at.

  • Object(n).expression lets you pick the nth instance of am object in an expression.

    https://www.construct.net/en/make-games/manuals/construct-3/project-primitives/events/expression

    See the section on object expressions.

    Iirc, this is special in that it can reference the values of an object that isn't currently picked by event conditions.

    There is nothing special about object.anything, as long as object.anything is any expression that returns a number that represents the object instance (n, or iid) you're trying to get at.

    ah ok so it is usable as a identifier of a specific object as long as u know the iid or N custom value u assign it to him. ok that is helpful thanks. also the link u sent doesnt work but this explanation solved my issue. thanks a lot. :D

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