I have two scenes (MainScene and ResultScene). The game starts with the MainScene. The first presentation of MainScene is good, the game runs smoothly, but if the game changes to ResultScene and from ResultScene back to MainScene, my hero sprite is vibrating.
Here's the method from ResultScene:
func presentScene() {
let scene = MainScene()
scene.size = self.frame.size
scene.scaleMode = .AspectFit
self.view!.ignoresSiblingOrder = true
self.view!.presentScene(scene)
}
Here's the way how i move the hero:
var velocity: CGFloat = 360
override func update(currentTime: NSTimeInterval) {
self.myHero?.physicsBody?.velocity.dx = self.velocity
}
And here's I modify the velocity:
self.increaseVelocityTimer = NSTimer.scheduledTimerWithTimeInterval(17, target: self, selector: Selector("increaseVelocity"), userInfo: nil, repeats: true)
func increaseVelocity() {
self.velocity += 60
}