Game Development Reference
In-Depth Information
Figure 7-6 . Anchor point moved to the left for simplicity
You can see in Listing 7-6 how this is helpful in the changed update method, which
now gives us endless scrolling.
Listing 7-6. Moving the Image Pairs Seamlessly
-(void) update:(ccTime)delta
{
for (CCSprite* sprite in spriteBatch.children)
{
NSNumber* factor = [speedFactors objectAtIndex:sprite.zOrder];
CGPoint pos = sprite.position;
pos.x - = (scrollSpeed * factor.floatValue) * (delta * 50);
// Reposition stripes when they're out of bounds
 
 
 
Search Nedrilad ::




Custom Search