Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am creating the simple game. In that game car will move and obstacles will come in the car way we will have to save that car from that obstacles. What I have done. I have created the car with the box2d body and I have added the parallax background now it seems that car is moving. The problem I am facing is that how will I add the obstacles box2d object randomly in the way of car ? How will I add the random box2d objects in the parallax background?


share|improve this question
up vote 0 down vote accepted

No one is going to write your code for you,

there are plenty of tutorials out there for cocos2d and box2d so i suggest you read them. Are you using tileD? Or are you just using a picture as a background?

if you use TileD you can add an objects layer with object nodes on it and tell your obstacles to spawn on the object nodes in tiled... Then just update the obstacles position to that of the object nodes..

Or if you are using just an image you can spawn the obstacles outside of the screen and then just move them along the same way that your background is moving... If you took away the background you would just see a car staying still with obstacles flying at it... But add a moving background and it looks like the obstacles are apart of the background.

Good luck

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.