2
votes

i have a similar situation to this Question. I want to keep the camera with the player in the center and the rotation of the player.

But i'm using box2d so i can't rotate the environment and keep the player static. how can i do this with cocos2d?

i only have code for the rotation, and i'm sure it's pretty wrong:

self.rotation = car.body->GetAngle()*(180.0/M_PI);

heres a bad sketch: bad sketch

thanks.

1

1 Answers

1
votes

This answer has a lot of information on moving backgrounds.

How to move background in cocos 2d

What you need to do is create a CCLayer, and rotate the layer. That would be the best approach as long as the screen shot above is accurate.

Here is a more detailed link with code. http://www.cocos2d-iphone.org/forum/topic/22376