简体   繁体   中英

How to implement horizontal scrolling in box2d?

I'm working on an iPhone game using box2D and I need to implement 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.

请尝试以下操作:intouchesEnd方法:

[self.parent runAction:[CCMoveTo actionWithDuration:.5 position:ccp(yourPosition,0)]];

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM