0
\$\begingroup\$

I'm looking for a way to implement a fighter-jet like movement behavior for my non-player entities in my 2D side-view shoot-em-up.

I.e. enemy entities (say jets or planes) can't suddenly change their facing or velocity vector, but instead should need to slow down and / or fly a curve in a wider angle, possibly depending on a properties like "agility" or "maneuverability".

Gravity is not relevant for Enemy entities.

The goal would be to have an enemy Entity that can ultimately "intercept" the players path to fire a projectile. However, just being able to move in a smooth way would already be a great help.

To be specific, assume the player is at position (200, 0), with its movement vector being normalized (-1, 0) (i.e. moving to the left). The enemy would be at position (400, 100), moving normalized at (1, 0) (to the right).

I'm at a complete loss on how I could implement such a steering behavior.

If it matters, I'm using Godot, so I have the built-in _process with a delta time variable.

\$\endgroup\$
5
  • \$\begingroup\$ what exactly do you want the behaviour to be? \$\endgroup\$
    – user253751
    Oct 11, 2022 at 11:43
  • 2
    \$\begingroup\$ You may be interested in this previous Q&A about maneuvering pirate ships to intercept the player. I show an example of how you can plot such an intercept course as cubic Bézier curve with a limited maximum acceleration. \$\endgroup\$
    – DMGregory
    Oct 11, 2022 at 12:32
  • \$\begingroup\$ @user253751 In the example above, i would want the jet to turn around and fly a curve either up or down, essentially then homing in on the player. The wideness of the curve would depend on the $agility of the player entity or something akin.Does that make sense ? \$\endgroup\$ Oct 11, 2022 at 13:40
  • \$\begingroup\$ Perhaps this one helps you: How do I calculate paths for objects with limited acceleration? \$\endgroup\$
    – Theraot
    Oct 11, 2022 at 21:21
  • 1
    \$\begingroup\$ @user431806 one idea is that the fighter jet calculates whether a left or right turn would let it intercept the player's line of movement sooner, then it turns in that direction at its maximum turning rate \$\endgroup\$
    – user253751
    Oct 12, 2022 at 13:52

0

You must log in to answer this question.

Browse other questions tagged .