How to detect when a sprite is not clicked?

Get help using Construct 2

Post » Sun Dec 15, 2013 1:38 am

A better rephrased question is:
What's the best way to detect a click that isn't on a sprite?

Background:
I have sprites that pop up and the user is supposed to click on them. I'm trying to determine when the user misses clicking on the sprite.

Possible solutions:
- Comparing every click with the left/top/right/bottom boundaries of every sprite displayed. But, this seems excessive and I feel that there is a better way. I just haven't found it yet.
- I added a click detection for the background layer, but unfortunately, that is still triggered when the sprite is clicked.

Other strategies tried:
- Adding an inverse or else to an On Object Clicked trigger is not possible.
- Tried adding a local variable to determine if the currently triggered click was on the sprite, but unfortunately doesn't appear to work well within triggers because they aren't called with the ticks.


Notes:
- Testing only in Chrome and with C2 r154.
- After figuring this out, I will also have to do this for touch events, but that should be simple enough.



danialgoodwin2013-12-15 02:28:14
B
20
S
4
G
1
Posts: 185
Reputation: 2,563

Post » Sun Dec 15, 2013 1:48 am

Hey there!
Have you tried this?

Should be something similar for touch.JJList2013-12-15 01:51:01
B
18
S
5
G
1
Posts: 74
Reputation: 2,672

Post » Sun Dec 15, 2013 1:55 am

[QUOTE=JJList] Hey there!
Have you tried this?

Should be something similar for touch.[/QUOTE]

I see the pic's URL you are trying to show is called "on_misclick" and that does sound promising. Unfortunately, I can't see the pic. ;]

Is this from another plugin?danialgoodwin2013-12-15 01:56:13
B
20
S
4
G
1
Posts: 185
Reputation: 2,563

Post » Sun Dec 15, 2013 1:59 am

- Mouse On Left button Clicked
- (INVERT) Cursor is over Sprite
-> ActionsEncryptedCow2013-12-15 01:59:18
B
47
S
14
G
7
Posts: 603
Reputation: 8,141

Post » Sun Dec 15, 2013 2:01 am

Oh, that's weird :O
Nah, just 1 event with basic C2 logics)
Yeah, what Cow said :PJJList2013-12-15 02:02:56
B
18
S
5
G
1
Posts: 74
Reputation: 2,672

Post » Sun Dec 15, 2013 2:26 am

Thank you both very much! That's exactly what I was looking for!

Btw, it was a pretty cool effect seeing text created every tick and being faded with the fade behavior. So, in order to make sure this misclick event is only called once, I added a boolean variable. Here's the full working sample that I am using:

Download "on_misclick" solution (event called once)
B
20
S
4
G
1
Posts: 185
Reputation: 2,563


Return to How do I....?

Who is online

Users browsing this forum: Ashley, dop2000, jatoblendy, MathNook and 33 guests