[Solved] Enemies to follow predefined path in space shooter


#1

Hello,

I’m trying to find a way to have my enemy ships follow a flight pattern. Is there a feature for this? Any help would be appreciated. Thanks.


#2

I’m not aware of any extensions that deal with pre-determined paths, and I 'd say you’ll have to devise something yourself.

There are a number of ways to approach this (given in order of my personal preference) :

  • You could create an object variable array of positions for the object to traverse towards, effectively hopping from point to point.

  • Another is to place hidden objects that direct the ship (either towards a position or angle) towards the next hidden direction object (you’d have to code the actions the hidden object perform).

  • Or you could “Hard code” the movement pattern in events. Once a movement has been completed, perform the next one.


#3

Thanks for your ideas. It looks like its over my head for now. Thanks anyways.


#4

Ok, though the first one (array of positions) wouldn’t be too arduous. I’ll post a screen shot of the events needed for it later on (in case anyone else is interested). Plus you have the forum (and Discord) to ask for help if you get stuck if you do take it on.

And fixed paths seems a good candidate for a new extension or behaviour. Keep your eyes peeled…


#5

I appreciate your help:)


#6

Hi, just an additional thought. If you mean with space shooter something like a shmup, the sine movement extension could be interesting for you.


#7

Yes, it will be a shoot em up. I did see the sine movement extension. I’m playing with it now. I’m trying to get my ships to do a u-turn or j-pattern. I’m not able to figure it out yet. Ideas? Thanks.


#8

For anyone that’s interested, here’s the result and how to do it :

FixedPath


And here is the object variable array set up (each array element is a structure). The X & Y parts are the relative position changes from the current position :


And the events that run it - I’ve added the angle change so it looks a bit tidier :


#9

Thanks for this. If I add more points will the movement of the object be smoother as it changes direction?


#10

Yes, if the points are closer together.


#11

I really appreciate your help.


closed #12