When the game changes levels I have a method that loads a new background and also changes several global properties of the SKScene ie enemy speed etc. Problem is when I redraw the background in a new level it covers all other nodes (created in initWithSize) . Is there a work around or a better approach redrawing the background?
Placing background node covers all other nodes level transition
167 Views Asked by dancingbush At
1
There are 1 best solutions below
Related Questions in SPRITE-KIT
- Calling Dealloc method in sprite kit
- How to call an object's methods in touchesBegan when touched?
- NSTimer won't start (Swift)
- iOS coordinates for iPad and iPhone game using spritekit
- How to segue to View Controller from skview
- In app purchasing asks to login on viewDidLoad and pauses the whole app
- SpriteKit share button not working
- TextField does not work
- How to make an SKSprite node move side to side on its own when game starts?
- SKAction.moveTo not working at all
- SKProduct keeps returning nil. SKPayment Transaction is not working
- How to check if two CGVectors are equal in Objective-C?
- How to translate SKPhysicsContact contactPoint into my SKSpriteNode position
- why isnt my second view loading after transition?
- SpriteKit using 95-100% CPU when running game with large tilemap (JSTileMap)
Related Questions in BACKGROUND-POSITION
- Endless Scrolling Background jumps at certain Viewport sizes
- Javascript checkbox to change background not working
- CSS Image position/focus
- bxslider + Chrome background position fixed
- Placing background node covers all other nodes level transition
- Why does css background-size/position not work with shorthand background url?
- Centering a background image with a gradient inline
- CSS Header Image "Stacked"
- IE 7 - Bug on css class inheritance
- IE 10/11 background position differences in links
- Set background position according to contents of span with jQuery
- Changing only y pos of background image via Jquery
- How can I minify CSS? Shorthand for property [ background-position ]?
- jQuery animate background position
- Position <body> background image relative to <div id="logo"> image
Related Questions in SKSCENE
- Import pictures from user's photo gallery and add to SKScene as circular image?
- iPhone 5s SpriteKit drawing oddities
- SpriteKit Game - SKScene Freezes during In-App Purchase in iOS 8.3
- How to display score in different scene
- SKScene bounds and positioning
- Spritekit: Change a scene and keep the background
- Display high score in a new scene with NSUserDefault in swift spriteKit
- In swift, how to get memory back to normal after an SKScene is removed?
- SpriteKit presentScene() Memory Leak
- SKScene runAction completion block not called
- Why does setting frameInterval on a SKView not work?
- How to catch right mouse button events with my SKScene
- SKEmitterNode explosion with force to another Object
- how to stack SKScenes in Xcode using Swift 3
- MKMapView in SpriteKit - Swift
Related Questions in LEVELS
- R - ddply summarise using nlevels() does not work
- Removing the levels attribute in the output - R
- return string of values of vector based on level in R
- Error in R with Months as levels. Is this a bug or logic flaw?
- What is a MultiIndex in Pandas and why is Pandas saying that I don't have a MultiIndex?
- Reduce levels from factor variable
- Error when replacing new factor levels in test dataset with `NA`
- setting levels apriori when using factorize in Pandas to cover missing cases
- Gesture recogniser crashing upon next level
- R: Make unique the duplicated levels in all factor columns in a data frame
- Placing background node covers all other nodes level transition
- R - levels are annoyingly messing things up, simple issue
- Delete labeled levels under a variable in R
- Determine or test signficance for certain levels in a variable using r
- Cannot pipe variable to levels
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
If I understand what you are saying you have a level which has a background node and other nodes that are displayed during the level. When you change levels, you add a new background, presumably as a child of SKScene, correct?
If this is the case, that is why it covers everything. By adding it later onto the node tree, it gets drawn last, and hence covers everything.
There are a few ways you can handle this:
-Have a different scene per level. This way each scene is self contained and will not interfere with the other scene's contents.
-removeAllChildren on the SKScene, and then add your background and anything else you need for the new level.
-If you really wanted to, you could just replace the texture for the original background with the newer background. But if you do this, you still potentially need to clean up old nodes.
Having a different scene is probably the better option out of the bunch.