I'm pretty close to having this figured out and just need the last bit (logic). In the following code, the background does scroll vertically (with touches) AND is going in the right direction (i.e. down).
The problem is it doesn't stop scrolling when it gets beyond the content size of the background image...
(CGPoint)boundLayerPos:(CGPoint)newPos {
CGSize winSize = [CCDirector sharedDirector].winSize;
CGPoint retval = newPos;
retval.y = -MAX(retval.y, -background.contentSize.height+winSize.height);
retval.y = -MIN(retval.y, 0);
retval.x = self.position.x;
return retval;
}
I am also wondering how to make the scrolling seem more natural...i.e. a way to continue for a while but slow down to a stop when TouchesEnded occurs...