I’m trying to have an image wrap around the window (When it falls off the left, it reappears on the right) I have a timer calling a function containing this:
bgImage.center = CGPointMake(bgImage.center.x - 5, bgImage.center.y);
if (bgImage.center.x < -self.view.frame.size.width/2)
bgImage.center = CGPointMake(bgImage.center.x + self.view.frame.size.width, bgImage.center.y);
NSLog(@"%f",bgImage.center.x);
When it falls off the screen, it comes back half way, then a little less each time. The console returns very large values for an x value
2012-02-09 13:33:44.229 Parkour Runner[1351:f803] 2: 28990.000000
2012-02-09 13:33:44.328 Parkour Runner[1351:f803] 2: 29285.000000
2012-02-09 13:33:44.429 Parkour Runner[1351:f803] 2: 29580.000000
2012-02-09 13:33:44.528 Parkour Runner[1351:f803] 2: 29875.000000
How about this instead? It will take into consideration the size of the image.