How to implement horizontal scrolling in box2d?
I'm working on an iPhone game using box2D and I need to impl开发者_高级运维ement horizontal scrolling... I was able to scroll the background textures and all... But, the problem is that, I'm not able to scroll the physics world of box2d... Please help me, how to move the box2d world... I'm not using cocos2d... I googled a lot, but was not able to find any solution without cocos2d...
Regards,
Suran
You should not move the world. Instead, try moving the "camera" (clip area) accordingly with the game character.
Try following: in touchesEnd Method:
[self.parent runAction:[CCMoveTo actionWithDuration:.5 position:ccp(yourPosition,0)]];
精彩评论