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'm developing simple traffic educational game like . When the player taps on car sprite, it started to move with other cars. If player made a mistake in choosing car, collision happens.

I decided to use Andengine for this game, because I have time limitation in developing it. So, the main problems is: How to make car automatically move along specified path with smooth turns? (and how to specify this path on map)

share|improve this question

If you already know the path then to make it move smoothly you would apply a low-pass filter to the actual movement. A simple low-pass filter that might work for you is the weighted moving average.

For example, instead of snapping the car directly to the path like this:

car.x = pathNode.x
car.y = pathNode.y

You would only move the car partway to where the next node is:

car.x = car.x + (pathNode.x - car.x) * 0.8
car.y = car.y + (pathNode.y - car.y) * 0.8

This gives up some accuracy to smooth out sharp turns over time. You will have to play around with the weight (0.8 in this case) until it looks good.

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.