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 made an animated main menu introducing my game. In the menu there is snow and fog to create a more alive feel to it. Now I want to add a hawk that randomly spawns and flies across the screen in the distance.

Any idea how I'd create a "path" for it to follow? The path would be a curved line or something for the hawk to follow to simulate realistic movement. I have no idea how to design this.

As a side note, I'm writing this game in Löve2D.

share|improve this question
Look up bezier curves. – Tetrad Jan 9 '13 at 0:10
up vote 10 down vote accepted

Spawn the object at a random location on the side of the screen. Additionally, give it a initial direction/velocity of straight across the screen +/- random 20 degrees at whatever speed you want it to move. Finally choose a random target location on the opposite side of the screen.

Now use steering to guide the object from its initial starting position and velocity to the target position. This way you only need to choose two positions and you'll get fairly natural movement while it's moving from one side of the screen to the other.

Alternatively, you can pick your start and end positions forming a line across the screen, then use mid point displacement to alter the line to make it less straight. (I suggest a higher (H) value closer to one so your bird doesn't look like it's on drugs).

enter image description here

Further, you can combine the two and steer between the deformed vertices on the displaced line. Creating smooth movement that's more random than one point to the next.

Or you can take those displaced line vertices and use them to make a Bézier curve and follow it exactly.

enter image description here

Another alternative is to use the wander behavior defined in this GDC paper from '99. You'd want to put some constraints on that to make sure your object reaches the other side, but it could give more interesting results depending on what you're going for.

enter image description here

share|improve this answer
Wow. Amazing response. Pictures and all :) Thank you so much. I'll be looking into it all tonight! – mbreen Jan 9 '13 at 0:40

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.