Game Development Reference
In-Depth Information
scene.scaleMode = SKSceneScaleModeAspectFill;
// Present the scene.
[skView presentScene:scene];
}
}
To ensure that the view hierarchy is properly laid out, we have implemented the
viewWillLayoutSubviews method. It does not work perfectly in
viewDidLayoutSubviews method because the size of the scene is not
known at that time.
3. Now compile and run the app. You should be able to see the background image
correctly. It will look something similar to the following screenshot:
4. So now that we have the background image in place, let us add gravity to the
world. Open GameScene.m and add the following line of code at the end of the
initWithSize method:
self.physicsWorld.gravity = CGVectorMake(0.0f, 0.0f);
This line of code will set the gravity of the world to 0, which means there will be
no gravity.
Search WWH ::




Custom Search