Phantom image for sprite sheet on alpha

I’m using a sprite with two frames as a UI toggle. When I place it on a rectangle with an alpha less than 1, the other frame of the toggle remains after transition, but semi transparent. When the underlying rec has alpha as 1.0 there is no phantom image after transition.

What could I be doing wrong?

Make a sample project that demonstrates your issue, zip it and upload it here. At the very least post some code.

Hi Thanks,

I’ve done just that, which helped me realized that the problem is more complex than it originally appeared since on an “empty” project the issue does not appear.

I’m attaching the sample with the code I use along with a screenshot of the problematic game.

Cheers!

juniper

Problem is likely ‘not’ complex.  This example by itself runs fine in my simulator (which you indicated it would), so the sample code is not helpful in figuring the issue.

 I am guessing that somehow in your full-code, you have more then one instance of the ‘toggle’ on top of another … maybe one under neath the rect(that has an alpha less then 1) … thus the lower version of the toggle gets that ghosted look. 

just my guess, based on the code you sent … if that is not the problem, you might need to send more example code.

Best of luck

Bob

Based on the project that you uploaded, I completely agree with Bob.

More often than not, when you upload a sample project to demonstrate your issue, but the issue isn’t visible there, then it isn’t that the problem is complex, but that the problem lies elsewhere in your code. As Bob said, the culprit is likely you creating two sets of buttons and the former is just left below in a semi transparent state and can’t be touched anymore since the latter button is positioned in front of it.

This can easily happen if you are creating the button within a loop that you accidentally call twice, or if you are using composer and that code is inside scene:show listener, for instance, and you haven’t defined whether the button should be created during “will” or “did” phase, which would lead to it being created twice.

Thanks guys your ideas helped a lot! The solution was rather simple in fact.

I was creating the group (background and toggle) on a button event. Only I forgot to include a check on the event so it was being create for “started” “moved” and “ended”.

Make a sample project that demonstrates your issue, zip it and upload it here. At the very least post some code.

Hi Thanks,

I’ve done just that, which helped me realized that the problem is more complex than it originally appeared since on an “empty” project the issue does not appear.

I’m attaching the sample with the code I use along with a screenshot of the problematic game.

Cheers!

juniper

Problem is likely ‘not’ complex.  This example by itself runs fine in my simulator (which you indicated it would), so the sample code is not helpful in figuring the issue.

 I am guessing that somehow in your full-code, you have more then one instance of the ‘toggle’ on top of another … maybe one under neath the rect(that has an alpha less then 1) … thus the lower version of the toggle gets that ghosted look. 

just my guess, based on the code you sent … if that is not the problem, you might need to send more example code.

Best of luck

Bob

Based on the project that you uploaded, I completely agree with Bob.

More often than not, when you upload a sample project to demonstrate your issue, but the issue isn’t visible there, then it isn’t that the problem is complex, but that the problem lies elsewhere in your code. As Bob said, the culprit is likely you creating two sets of buttons and the former is just left below in a semi transparent state and can’t be touched anymore since the latter button is positioned in front of it.

This can easily happen if you are creating the button within a loop that you accidentally call twice, or if you are using composer and that code is inside scene:show listener, for instance, and you haven’t defined whether the button should be created during “will” or “did” phase, which would lead to it being created twice.

Thanks guys your ideas helped a lot! The solution was rather simple in fact.

I was creating the group (background and toggle) on a button event. Only I forgot to include a check on the event so it was being create for “started” “moved” and “ended”.