ios - Reset scene in SpriteKit -


I already have two different view controllers in one with a SKScene Find the game and points with the "Play again" button in the second game. When the game is over, then I remove that scene and my problem is that when I click on the "code" and init again, when the user clicks on "replay" If after the game has ended, and after resetting it, a fixed SKSpriteNode was rotated, when I go back to that scene, before removing the view it will be at the same angle Is rotated. -initWithSize is called correctly, so I'm not sure why this is happening. My question is if there is a way to reset SKScene This is like the first game played. Thanks!

Yes, make a method that creates a scene in the first place and remembers it if you If there are things that are close, then remove them from the parents before returning their visual creation method.

Example:

  - (id) initWithSize: (CGSize) size {{super initWithSize: size]; [Self-nudegame]; Self return; } - (Zero) startNewGame {// Configure All Your View Here} - (Zero) Buttons CallOnStartClick on [[Game of Self-Beginning]; }   

In the same reason you are looking at your phantom because you can not remove it from the scene when you restart it, since you probably should completely rebuild your view, you will see all the objects Should be removed from the scene and then call your "startNewGame" method again.

Example of extracting all objects from the scene:

 for  (SKNode * node. Children themselves) {[node removal head]; }    

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -