Touching an invisible object.

Hi,

I was trying to have buttons in my game but when i save them as .png's there's always white pixels around the transparent bits.
It's really Annoying!

So i thought i'd just build them into the background and have an invisible Rect on top of them indicating their button-ness, and acting as the button.

Problem is when i set the Rect to .alpha = 0;
Or .isVisible = false;

I can no longer touch them to utilise them as buttons.

Is there a workaround or do you guys think i should really figure out this transparency issue? :(

Hey T.H.T.,
I have experienced the same thing in my game. I think touch events just don't render on transparent objects. A very simple fix would be to set the alpha to .01 or something like that. As for the white pixels, I'm not sure why that is happening.

try to set the .alpha to 0.01

cheers,

?:)

Oops, sorry. My page wasn't refreshed so I didn't see the post by OZ.

If you would prefer your object was actually invisible rather than just very, very transparent at alpha = 0.1, you can do this too;

1
2
obj.alpha = 0
obj.isHitTestable = true

What are you using to create your graphics?

Sounds strange to me that there are always white pixels when it should be transparent.

How familiar are you with alpha channels etc?

If you can find and eliminate the problem with the white pixels, then it's problem solved.

I'll give Peaches isHitTestable a go for now.

It's true that being able to create the buttons alone would reduce Texture Memory as i could reuse the background for different screens if it didn't have buttons built into it.

@spider_newgent

I use Photoshop to create and save my graphics.
I'd say i'm pretty good at using it. (Without my ego going growing ;))

I don't know much about alpha channels as such.
I did try to using a plugin that stores the transparency data into an alpha channel.
This caused the Transparent parts to go solid colour (But really be transparent in alpha channel)
But when i put it into Corona the image stayed with the solid colour all around.
I don't know if there's any param i have to activate in Corona to read the alpha channel?

I could post a picture if you think it'll help?

views:1583 update:2011/11/14 9:16:56
corona forums © 2003-2011