开发者

fast scrolling background

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

An开发者_如何学JAVAy idea to solve that?


You could try using the canvas element

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜