Mouse click on object but not on release through layouts.

0 favourites
  • 4 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • I have two Layouts: Layouts1 and Layouts2.

    On Layouts1 there is a button (sprite actually) "Exit game" and on Layouts2 there is a button "Go to Layouts1" exactly at the same position.

    When is set an condition "Mouse click on object" -> "Go to Layouts1" it moves me to Layouts1, but so fast, that I can't release the mouse button in Layouts2. So I release the mouse button on Layouts1, but that triggers another button "Exit game".

    So Is there some sort of condition, that will prevent that behavour?

    Something like: "Release on object"? or "Press down on object" ?

    It seems like "Click on object" works for both "Press" and "Release", and then, "Release" continues on another Layouts, after going there, that triggers things on the new layer.

    Thanks for any help.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • "On object clicked" is the same as "Button released".

    The thing is that your two object are taking the event and you should at least try to prevent this from happening to one if it is invisible.

    If those are regular "Button" objects, add a condition "Layer X is visible" where X is the layer the button is on to your "On button clicked" event.

    If you did things correctly, Layer 2 is by default set to be invisible and this should prevent the button from being clicked until the layer it is on is visible.

    Adding a "Wait 0" system action before setting the layer visible will even help further preventing the click action to be taken into account by the button.

  • Oh sorry, its all sprites and I ment LAYOUTS not Layers...... ups

    I will try your suggestions. Thanks

  • Ok i figured it out.

    I had both: "click on object" and "touch tap" event on sprite. I didnt realise, that "touch tap" also works with mouse left click. And that was giving me the "double click" through layouts. I just removed the "click on object" and its fine now.

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