ONE of my sprite buttons doesn't always work... why?

Discussion and feedback on Construct 2

Post » Sat Jan 23, 2016 4:05 pm

I am making a web app and I have several rectangular sprites that I use as buttons. ALL of my buttons work great... except one. At first it seemed to fire off randomly when I tapped it, but there are certain places -- near the middle of the button -- that will never register a tap or click. But there are other spots on the sprite that will register a Touch event every single time. The buttons are all the same so I can't figure out why one of them only works part of the time...

I'm sure this is an issue with my code but I don't know even know where to begin to start looking. Any suggestions? I have some invisible text objects in the same area, but they are all on the same layer so clicks should pass through, right? I made my button opaque in case it was a transparency problem, but that didn't help either...
B
11
S
3
Posts: 79
Reputation: 854

Post » Sat Jan 23, 2016 4:22 pm

John Cutter wrote:I have some invisible text objects in the same area, but they are all on the same layer so clicks should pass through, right?


Why would you think that?
Using invisible sprites as triggers is a fundamental part of programming. In your case it might be OK but impossible to say.

Without seeing your Events, .capx etc it is not really possible to offer any meaningful guidance.

Just in case, check you collision polygons are correct and not overlapping.
If your vision so exceeds your ability, then look to something closer.
Moderator
B
134
S
30
G
84
Posts: 5,388
Reputation: 58,458

Post » Sat Jan 23, 2016 4:39 pm

It's definitely your collision path by your description.
That bottom icon on the left toolbar. Click it and the polygon will show.

Image

The Manual:
https://www.scirra.com/manual/48/image-and-animations-editor

Yes, a click on a spot on screen will touch each sprite (if in it's polygon) under the cursor. Even if invisible.
B
231
S
62
G
33
Posts: 902
Reputation: 40,348

Post » Sat Jan 23, 2016 5:02 pm

Thank you, thank you, thank you! My sprite is a simple rectangle so I assumed the collision polygon would automatically match the shape. Nope, my poly looked like a Picasso painting. :-) Appreciate the help, guys!
B
11
S
3
Posts: 79
Reputation: 854


Return to Construct 2 General

Who is online

Users browsing this forum: Baidu [Spider], Sventevith and 11 guests