Mouse click on object but not on release through layouts.

Get help using Construct 2

Post » Thu Sep 15, 2016 10:57 am

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.
Last edited by haopl on Thu Sep 15, 2016 11:36 am, edited 2 times in total.
Posts: 10
Reputation: 245

Post » Thu Sep 15, 2016 11:07 am

"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.
New to Construct ? Where to start

Image Image

Image Image

Please attach a capx to any help request or bug report !
Posts: 7,380
Reputation: 73,836

Post » Thu Sep 15, 2016 11:33 am

Oh sorry, its all sprites and I ment LAYOUTS not Layers...... ups :(
I will try your suggestions. Thanks :-)
Posts: 10
Reputation: 245

Post » Sat Sep 17, 2016 8:19 am

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.
Posts: 10
Reputation: 245

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 5 guests