Game Development Reference
In-Depth Information
5. Add a method addGameBackground under the adding assets method's
pragma mark in which a SKSpriteNode is created, with the image Back-
ground.png added previously in the project. Keep the z position of background
as 0 as it will be below all other nodes of the game.
- (void)addGameBackground
{
SKSpriteNode *gameBGNode =
[SKSpriteNode
spriteNodeWithImageNamed:@"Background.png"];
{
gameBGNode.position =
CGPointMake(self.frame.size.width/
2,self.frame.size.height/2);
gameBGNode.zPosition = 0;
[self addChild:gameBGNode];
}
}
Search WWH ::




Custom Search