Understanding Condition Placement Within A Function

  • I've had a bug in my game that I was unable to figure out for months. Today I managed to, (or so it seems), get to the bottom of it. However, I still don't understand why the change I made works. I was hoping someone could bring to light why this change works.

    The issue: A sprite is set to visible in a function, and then a function below this action is called and checks if this sprite is visible. AKA:

    Call first function: set sprite visible (within first function then call second function which checks if sprite is visible)

    The confusion:

    This image was how I managed to solve (works so far) the issue. Instead of placing the check if sprite is visible nested in the top of the function, placing it as a sub event beneath the top of the function with NO other change allows it to work. There are no actions in the top part of the function that precede this conditional check and thus the ONLY difference is placing it within the functions start or below as a sub event. Did I miss something in the manual that makes note of this, is it most likely a timing issue, are conditions placed within the top of the function ran a tick earlier?

    Just trying to improve my understanding of the engine.

    Thank you for your time,


  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • There should be no difference at all between these two cases. If there is, please file a bug.

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