Not all objects linked by a variable behave the same?

  • Hi folks, either it's my crappy condition design or it's a bug (so probably the first one). I'm trying to link several instances of two objects together with an ID variable. If one changes its animation, the linked one with the same ID is supposed to change it's animation too. This seems to work just in 80% of the cases. I'm confused. Please see the project-file: https://gofile.io/?c=nYpWeF

    The way it is supposed to work: the red square can turn either of the green or orange rectangles blue by coming close enough. The attached rectangle (linked by ID) is supposed to change its animation too.

  • Why do you have "Trigger once" in these events?

    If all these objects always exist in pairs, you need to add them into a container. This way there will be no need for an id variable, instances in each pair will be logically linked together. You can simply do "if LeftSide animation N is playing -> RightSide set animation N". Or even "RightSide set animation to LeftSide.AnimationName"

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Why do you have "Trigger once" in these events?

    In my twisted mind, I tried to prevent the condition from firing every tick with "trigger once" and save some CPU power this way.

    you need to add them into a container ... each pair will be logically linked together

    Yeah, wow - it works that way! I couldn't imagine how a container object would figure out the neighboring object is his container partner without an ID. But it seems to be the time of creation in the editor that links them together. Many thanks for the help and this hint.

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