# Best way to create intricate patterns for bullets and enemy movement in a shootemup?

4.2.1

### Question

I want to make 2D shootemup bullethell with each enemy type having their own movement and shooting pattern.

What’s the ideal way to code each of these? I can think of 3 ways.
-Math and positions/velocities
-Tweens
-Custom Paths

Are they all viable or is one of them preferred over the others?

For bullet patterns, you might want to take a look at:

Other than that, I think your question is a bit broad. There’s no such thing as “the best way”. That’s like asking: “What is better, a hammer or a screwdriver?” - it all depends on the situation at hand!

Custom paths will help you visualize the trajectory of an object, but can be annoying to modify and adapt to a slightly different situation. Tweens will (sometimes) save you from setting a bunch of positions that also can be interpolated, but there will likely be situations where the required interpolation functions get too complex. So in the end it all comes down to the first way of doing some math manually, unfortunately.

I have the same question as the OP, so I don’t wanna make a new post, but I will add some points regarding my game, hope you’ll help with that.

So my game will be a fixed top down shmup, similar to Gun Nac or Crisis force for the NES. So it won’t be an arcade style infinite shooter, but there will be levels with intricate backgrounds.

For the backgrounds I made a tilemap which will move slowly or quickly to simulate movement.

At certain intervals I want waves of enemies to come in a certain pattern, could be a zigzag pattern, could be a homing one to the player, depends on the enemy… each enemy type has a certain pattern.

My first thought was that I could use path2D to predefine the patterns, but you can’t have a pathfollow2D as a child of the enemy, even if you do, the path will move along with the enemy which would break the system.

So I thought I can have a predefined list of Paths for the types of enemies which would come, but with the count of enemy types, it would become convoluted and hard to manage them.

So what would you suggest in my case?