A sprite that is set to not visible seems to be screwing up the redraw rects. Anybody seen something similar?

My game has a map.

It is a large sprite with the top-left corner positioned at 0, 0.

My main gameplay uses setDrawOffset to move the camera around, and the setDrawOffset is set to different values when displaying the map. (Maybe this is not relevant. Who knows.)

the map sprite is set setVisible(false) when created, then true when shown, and false again when hidden.

After the map is displayed once, all of the redrawing of the screen goes screwy, and as the player moves around, seemingly random parts of the screen get redrawn, or not.

I was seemingly able to fix the issue by setting the map sprite's Zindex to a really low value while it is hidden. that seems to work in certain areas of the game, but it started happening again.

If I setAlwaysRedraw(true), then the problem is completely fixed. So I don't believe there is any kind of logic issue in my code. But somehow I'm breaking the redraw rects system.

Can you provide a screenshot of how the drawing is messed up?

Is the situation helped by doing a one-time setDirtyRect of the whole screen after the map is hidden?

Hi,

Temporarily redrawing the whole screen doesn't solve the problem. As soon as you stop forcing a refresh of the whole screen, the problem continues.

image

A static image doesn't really give a good feeling of the problem.

In the above image, you can see a few areas where it has attempted to redraw. this is where the player has moved in the space. But the redrawn area is smeared.
The player (The cylinder shape) seems to move behind invisible walls, and just half appear from behind them in random areas and causes a smeary redraw.

The room shown in the image should actually move as the player moves, and thus be redrawn. But it doesn't move (or get redrawn.)
It's possible for the player to move through one of the doors into a completely differently shaped room, but it still displays the previous room.

I'd be happy to share my entire source code if somebody wanted to look at it.