Advertise here




Advertise here

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

iOS spritekit nodes stutter when transitioning from scene

I'm developing a game in iOS Spritekit using Objective C. I created a menu view in viewController and from that I'm calling a gameScene. In gameScene I uses five different nodes which has to released one by one randomly from the top of the screen. Each of those five nodes have 4 different images so it is stored in atlas. If the node moves to the bottom of the screen I change the image in the node and release from the top of the screen.

I'm releasing the node using the following code
self.wait = [SKAction waitForDuration: 1.0];
self.run = [SKAction runBlock:^{
if ([nodesArray count] > 0) {
   //select the node to release randomly and remove it from array
}
}];
self.seq = [SKAction sequence: @[self.wait, self.run]];

Those five nodes are stored in an array called nodesArray.

Now my problem is that I noticed a stutter when the nodes are released from the array. I don't know why these stutter are occurs as it's random, these predominantly occurs when the scene is restarted or If I come from another scene to game scene. When I come directly to GameScene without any intermediate scene with just a Launchscreen.xib , there is no stutter.

For restarting the scene I call the scene by the following code
GameScene *firstScene = [GameScene sceneWithSize:self.size];
[self.view presentScene:firstScene transition:[SKTransition fadeWithDuration:1.0]]

PS. I also tried implementing Menu as a scene and returning to game scene, nevertheless it too causes random stutter in the game scene irrespective of whether I remove the Node's & Actions before I leave the Game Scene.

This is the bug which is stopping me from releasing the game, so any help will be appreciated.
Sign In or Register to comment.