Help - How to make enemies follow any path?

Hi everybody,

I’m currently working on a bullet hell game and I’m stuck on getting the enemies to move in predetermined paths. Not just straight paths, but pretty much any kind of path you can draw on a piece of paper. For example, right now I’m trying to make the enemies move along a curved path that kind of looks like a logistic graph.

So far, I’ve tried using coroutines to divide the path into different parts (move straight 1s, curve 1s, straight 1.5s, etc.) but it seems inelegant and doesn’t work very well (the enemies end up at slightly different positions).

I’ve looked around a little bit and I’ve found things relating to Bezier curves, which I don’t know, and waypoints, but the examples I found were only for straight lines, unless you make a lot of them so that it seems curved. Also, the enemies should rotate with the movement so that they’re going straight.

So is there a general rule of thumb or common practice in creating such paths? Is it one of the two I mentioned and I’m just thinking about them wrong?

Thanks for the help.

Check out the Unity animation system. You can use it as-is, or you can combine it with mecanim state machine and some light scripting, and you can make your object do all kinds of interesting things based on putting together individual pieces of animations in a row.

Thanks, Kurt! I didn’t think about animating it like that. I’ll try it out.

You can also do other clever things like animating a ghost object and having multiple entities parented to it to cause formation flight, for instance.