Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Phantom image for sprite sheet on alpha
Started by juniperlanegames Aug 27 2019 01:46 PM

5 replies to this topic
[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

juniperlanegames

[GLOBAL: userInfoPane.html]
juniperlanegames
  • Observer

  • 4 posts
  • Corona SDK

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?

[TOPIC: post.html]
#2

XeduR @Spyric

[GLOBAL: userInfoPane.html]
XeduR @Spyric
  • Contributor

  • 989 posts
  • Corona SDK

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



[TOPIC: post.html]
#3

juniperlanegames

[GLOBAL: userInfoPane.html]
juniperlanegames
  • Observer

  • 4 posts
  • Corona SDK

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!

Attached Files



[TOPIC: post.html]
#4

cyberparkstudios

[GLOBAL: userInfoPane.html]
cyberparkstudios
  • Contributor

  • 573 posts
  • Corona SDK

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



[TOPIC: post.html]
#5

XeduR @Spyric

[GLOBAL: userInfoPane.html]
XeduR @Spyric
  • Contributor

  • 989 posts
  • Corona SDK

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.



[TOPIC: post.html]
#6

juniperlanegames

[GLOBAL: userInfoPane.html]
juniperlanegames
  • Observer

  • 4 posts
  • Corona SDK

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".




[topic_controls]
[/topic_controls]