Game Development Reference
In-Depth Information
self.spaceBlueSkyParallaxNode.position =
CGPointMake(0, 0);
[self addChild:self.spaceBlueSkyParallaxNode];
}
7. Similar to the blue sky background, we have to implement the mist images as
well. To add more reality to the game, we will add the
mistParallaxBack-
groundImages
function.
NSArray *mistParallaxBackgroundNames =
@[@"SpaceWhiteMist.png", @"SpaceWhiteMist.png",];
self.spaceWhiteMistParallaxNode =
[[FSParallaxNode alloc]
initWithBackgrounds:mistParallaxBackgroundNamessize:self.frame.size
speed:-SPACE_WHITE_MIST_BG_VELOCITY];
self.spaceWhiteMistParallaxNode.position =
CGPointMake(0, 0);
[self addChild:self.spaceWhiteMistParallaxNode];
8. Once the nodes have been added to the scene, they need to be updated for
scrolling purposes. So call the
updateForDeltaTime
function of
FSMyS-
cene
for both the nodes.
if (self.spaceBlueSkyParallaxNode)
{
[self.spaceBlueSkyParallaxNode
updateForDeltaTime:self.diffTime];
}
if (self.spaceWhiteMistParallaxNode)
{
[self.spaceWhiteMistParallaxNode
updateForDeltaTime:self.diffTime];
}