Combine several SKScenes in Sprite Kit
Asked Answered
R

1

7

I am currently struggling with the following problem:

I am creating a Sprite Kit game in Objective-C, in which I have to use a parallax-animation in all 3 scenes. I use clouds with randomly generated X and Y positions. They appear in the greeting scene, in the game scene and in the highscore scene.

Problem: whenever I switch from one scene to another, I have to restart the parallax-animation, which leads to an messy interruption.

What might be the best strategy to keep the "cloud scene" running all the time in the background, no matter how many times you switch between the game scenes?

Thanks in advance.

Rajput answered 4/11, 2015 at 15:25 Comment(0)
S
3

For this purpose, consider using only one scene and for each game theme (i.e greeting, game, highscore) use an SKNode which will contain the required elements for its purpose (e.g. the greeting node will have its greeting elements).

This way you can easily keep a "constant" SKNode (i.e. add it once to the scene when the game is first loaded) which will contain your parallax clouds and add/remove required node for the greeting game and highscore when necessary

Sporocarp answered 4/11, 2015 at 15:42 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.