fast scrolling background

Posted by Andre on Stack Overflow See other posts from Stack Overflow or by Andre
Published on 2011-06-28T12:45:26Z Indexed on 2011/06/28 16:22 UTC
Read the original article Hit count: 217

Filed under:
|
|

i want a game that scrolls the background in a similar way to a UItableView. I solved it with a timer that moves the background up and brings another copy of the same picture up

if (bg1.center.y <= - self.view.bounds.size.height/2 ) {
    bg1.center = CGPointMake(bg1.center.x, 690); 
}
if (bg2.center.y <= - self.view.bounds.size.height/2 ) {
    bg2.center = CGPointMake(bg2.center.x, 690); 

bg1.center = CGPointMake(bg1.center.x, bg1.center.y - movement);
bg2.center = CGPointMake(bg2.center.x, bg2.center.y - movement);

But the faster i move the pictures the more problems occur: There are appearing gaps between the backgrounds and they are getting biggiger the faster i move them! movement is defined by the speed of swiping over the screen

Any idea to solve that?

© Stack Overflow or respective owner

Related posts about background

Related posts about scroll