SKTileMapNode fadeout/in errors

Hi All,


I am working on a project which has 3 SKTileMapNode defined of size 96 X 8 (Tile Size 128 X 128)

102 X 8 (Tile Size 128 X 128)

206 X 6 (Tile Size 64 X 64)


The problem is that when I try to fade down the WorldNode to which everything else is a child some of the SKTileMapNodes do not fade down? then when I fade up from a black screen back into the game some of the SKTileMapNodes are not appearing and the suddenly pop back up. I can only assume that fadeing out large TileMaps is a problem or have I missed something?

Answered by CartoonSmart.com in 229339022

Instead of fading everything out, it'll be less taxing on Sprite Kit to fade in a solid color, like black. So a run time you just create an SKSpriteNode with a color, put it's Zdepth above everything, start the alpha at 0, then fade that in.

Accepted Answer

Instead of fading everything out, it'll be less taxing on Sprite Kit to fade in a solid color, like black. So a run time you just create an SKSpriteNode with a color, put it's Zdepth above everything, start the alpha at 0, then fade that in.

Thanks 🙂 I did begin to think that fading down lage TileMapNodes was to big an overhead. Thanks again for the laterial thinking.😉

I loved this idea of using the black sprite node however it still presented issues for me when transitioning between two "scenes" that contain SKTileMapNodes.

So what I do is have a wrapper node that is a subclass of SKSpriteNode. When I want a tiled background, I create an instance of this class that internally creates an SKTileMapNode that is never actually presented. Once that SKTileMapNode is created, I then create a texture from it and initialise my wrapper object using that texture.

From then on, it is a simple SKSpriteNode that obeys the alpha like all good SpriteKit nodes should, and I don't have to do any fiddles with black nodes.

p.s. I can't believe (though I should by now) that Apple have not been able to bring themselves to fix this after 6 years.

SKTileMapNode fadeout/in errors
 
 
Q