One sprite being obscured by another invisible sprite

can anybody help explain this: my cursor (z-index 4) is being obscured by another sprite (z-index 5) but that sprite's :isVisible() returns false .

i can work around it by changing the z-indexes, but that would be a hack that will bite me in the future I am sure. so i'd like to understand why the invisible layer is obscuring lower layers?

if i press a button and redraw the whole screen everything displays as expected until the cursor is moved, at which point it becomes obscured again.

plus there is some real oddity with highlighted drawing areas not updating correctly when it is obscured - towards the end of the video you can see the orange highlight stays on the right hand side until the cursor pops out from the left after being obscured.

maybe something dirty rect related? i honestly am out of ideas. thanks!

(macOS, Simulator 1.13.5 and hardware 1.13.7)

1 Like

Do you think its possible to change the z-5 sprite to transparent/white to see what is happening?
I feel like its being accidentally drawn or called. However I haven't tried sprites out myself yet, just simple whole screen redraws.

That's a good idea and not something I had tried last night.

Clearing the image assigned to the sprite as transparent makes no difference, it still obscures.

BUT, if i clear the image to transparent and then do obscuringsprite:setImage(sameimage) then it stops obscuring?!

Just doing the obscuringsprite:setImage(sameimage) on its own makes no difference, it still obscures.

WHAT, my head hurts now.
Could it be when it refreshes it doesn't actually refresh and draw whats below it?

Hey @matt do you have some example code that you could share with me that demonstrates this? (if it's not something you want to share publicly, you can email me instead).

I've been trying to recreate the issue in a sample project but haven't had any luck yet. I'm starting to wonder if it might have to do with the specific position or dimensions of the sprites you're using.

It does seem like it's possibly an SDK bug, and it does look like the dirtyRect is not being updated correctly.

(I was able to reproduce a bit of weirdness that's similar to the highlighted orange drawing area on the right side of your invisible sprite, but not the part where an invisible sprite is still obscuring another sprite)

1 Like

It's all in source control so I'll send a zip of a snapshot in tomorrow my time.

I have multiple full screen sprites (one each for play field and highlight layers) plus the slightly smaller obscuring invisible panel, and the tiny cursor.

Email sent! thanks in advance

Thank you! I managed to reproduce the issue in a test project. I haven't looked into it in too much detail yet, but it does seem like an SDK bug to me. Hopefully we can get a fix in soon!

2 Likes

Does this have to do with full screen sprites with transparency?

I'm working on an old prototype and want to support rotation of the device, everything is drawn into sprites normally but as soon as I rotate them 180' in code everything just disappears and starts behaving really oddly.

I wasn't doing anything like that in my test project, so I don't think it would be related, but I don't want to say that definitively as we haven't had time yet to figure out exactly what's happening with this bug.

No worries, I filled a new bug for what I was seeing.

I believe this is fixed in the 2.3 update, for the record.

1 Like