Suran
Suran

Reputation: 1227

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

Upvotes: 0

Views: 771

Answers (2)

rptwsthi
rptwsthi

Reputation: 10172

Try following: in touchesEnd Method:

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

Upvotes: 2

Omiod
Omiod

Reputation: 11623

You should not move the world. Instead, try moving the "camera" (clip area) accordingly with the game character.

Upvotes: 2

Related Questions