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'd like to create a game where a car drives over a 2D terrain. Which algorithm to use so the car will follow the mountain incline?

share|improve this question
What exactly are you trying to achieve? Model the road, so that the car cannot drive off the road? What's the deal with the mountain? Is there anything special regarding the mountain, compared to a "regular" road? – bummzack Nov 24 '11 at 11:03
its road you are right , im looking for way to drow aroad , then the car be able to drive . something like this : – user3689 Nov 24 '11 at 11:18
Google "Perlin noise" for terrain generation, as for the other part of the question, I really don't know. – jcora Nov 30 '11 at 11:11
up vote 3 down vote accepted

The game you linked to in your comment most likely uses a physics-engine like Box2D (flash port) for the car physics. So the basic steps are: Create a car body with connected wheels (use joints) and use either a procedural approach or a level editor to create the terrain.

The car following the terrain will be handled by the physics-engine if you set things up correctly.

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.