iOS Game Programming Cookbook by Bhanu Birani & Chhavi Vaishnav

iOS Game Programming Cookbook by Bhanu Birani & Chhavi Vaishnav

Author:Bhanu Birani & Chhavi Vaishnav
Language: eng
Format: mobi, epub, pdf
Publisher: Packt Publishing
Published: 2015-03-24T22:00:00+00:00


// 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.

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:

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.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.