Spritekit: Change a scene and keep the background

383 views Asked by At

I'm developing a game that needs an independent animated background. The game need to change some scenes, keeping the same background. Depending on user input, the background will animate accordingly.

Since the scene's background moves with the scene, on transition, how can I achieve this? The only way I can imagine is have 2 SKViews, each with a scene. So I can have a background scene and a foreground scene separately. But I have no idea if it is possible and how can I do this.

Any help is appreciated!

My best,

Gui

1

There are 1 answers

0
Epic Byte On BEST ANSWER

You can't preserve nodes across scenes. You must add the node again during each scene transition. This is why I do not use Apple's scene transitions the way the documentation describes. Instead I use my own custom SKNodes and make my own custom transitions using those nodes, which I highly recommend you do. I gave a detailed answer about this here