How do I Enable/Disable object instance?

  • Hi

    Not sure if the best workflow but the idea is having a Sprite button (Touch event) that I want to enable/disable based on some logic.

    If I set "initially visible" to false still gets the touch event.

    So the idea is to hide it and avoid getting touch event.

    I'm currently creating/destroying it... is there a better way?

    Thanks.

    Tagged:

  • OK, I figured something better than creating/destroying.

    The idea is to have a boolean instance variable that says if it's active.

    So when I want to hide it I set visible to False and IsActive to False.

    So when I have a touch event I also check for the IsActive instance variable to respond.

    Is that good or there is something more Construct way?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You can not disable touch. What you can do is ignore it, for example when the object is invisible. Simply add "MyButton is visible" condition to your "On MyButton touched" event.

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