Disable mouse click on object

0 favourites
  • 6 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • Hi,

    Is there a way to disable a mouse click on an object based upon the value of a variable?

    E.g. Disable mouse click on object X in case var_a = 0

    Your help will be much appreciated.

    Regards,

    SPX

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Maybe there's a better way, but you could put an invisible object on top of the object in question, and destroy/spawn it depending on the variable. Then apply the mouseclick events to the invisible object.

  • Thank you, this worked like a charm!

  • how is posible to do that?

    when i put invisible object over some i dont want to be clicked, still ghet clicked

    even i put him in new layer and still same

  • anyone help?

  • how is posible to do that?

    when i put invisible object over some i dont want to be clicked, still ghet clicked

    even i put him in new layer and still same

    The invisible object are not meant to block the object under it, it's just like a hit area / hittest, so give your events to that invisible object, not the object under it.

    And, if you want to activate/deactivate the mouse click logic, just destroy/spawn that invisible object. Or, if you want more advance, you can add your own (instance) variable, e.g: disabled. Then, in your mouse click event, add another event condition to check if it is not disabled.

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