dangerous curves

Started by
1 comment, last by BenjaminSergent 12 years, 4 months ago
How do games generally make enemies move in really curvy ways like in Blazing Lazers?

Advertisement
Sin and cosine functions will give you the nice curvy waves. Just check out trigonometric functions.

Hazard Pay :: FPS/RTS in SharpDX (gathering dust, retained for... historical purposes)
DeviantArt :: Because right-brain needs love too (also pretty neglected these days)

If they are on a set pattern, trigonometric functions are useful. If their movement is not on a set course, such as if they are reacting to the player, then there are a few methods to achieve those smooth curves. The main way is to model their movement as vectors and change an object's movement using velocity and accelerating vectors.
eg: If an object's velocity is (3,0) and its acceleration is (-1,2) for 3 seconds, then it will smoothly change course from east to north while accelerating. In the case of a game like blazing lazers, this is like simulating thrust.

This topic is closed to new replies.

Advertisement