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!