How to make a spinning follow enemy?

So, I’m working on a new boss that is a combination of two of the strongest enemies.

It follows the player (Slowly) and Spins at up to 4! The only problem is: I have no idea how to make something that spins and moves in a certain direction. It’s REALLY complicated and takes more code then just a few Globals and a velocity.

If you think you know how to do this, I’ll post the link, but not now.
Thanks,
-Ember.Y

2 Likes

So, like a homing missile?

1 Like

Sort of. I already have an easy way to make the enemies follow the player. The only difference is: This enemy spins very fast, which alters the forward direction.

1 Like

Use this bundle: It is a very useful bundle made by JR01.

{"data":{"behavior":{"v":"2","nodes":[{"inputCount":2,"outputCount":2,"name":"AngleToSpeed","behaviorType":"logic.NodeGroup","x":540,"y":128,"id":"c368115112be4540","notes":null,"isMenuItem":false},{"expression":"B*Math.cos(A*(Math.PI/180))","default0":0,"default1":0,"default2":0,"default3":0,"default4":0,"default5":0,"params":2,"version":1,"tag":"Cos","inputCount":3,"outputCount":1,"name":"Expression","behaviorType":"logic.logic.Expression","x":720,"y":640,"group":"c368115112be4540","id":"c36811526918e246"},{"expression":"B*Math.sin(A*(Math.PI/180))","default0":0,"default1":0,"default2":0,"default3":0,"default4":0,"default5":0,"params":2,"version":1,"tag":"Sin","inputCount":3,"outputCount":1,"name":"Expression","behaviorType":"logic.logic.Expression","x":720,"y":768,"group":"c368115112be4540","id":"c36811539b2cf540"},{"inputCount":0,"outputCount":1,"name":"Bundle Input","behaviorType":"logic.NodeGroupInput","x":360,"y":640,"group":"c368115112be4540","id":"c3681153b31db344","portId":"c368115112be4540i0","tag":"Angle","dataType":2},{"inputCount":0,"outputCount":1,"name":"Bundle Input","behaviorType":"logic.NodeGroupInput","x":540,"y":768,"group":"c368115112be4540","id":"c368115371335448","portId":"c368115112be4540i1","tag":"Speed","dataType":2},{"expression":"((A%360)+360)%360","default0":0,"default1":0,"default2":0,"default3":0,"default4":0,"default5":0,"params":1,"version":1,"tag":"Angle","inputCount":2,"outputCount":1,"name":"Expression","behaviorType":"logic.logic.Expression","x":540,"y":640,"group":"c368115112be4540","id":"c368115388672342"},{"inputCount":1,"outputCount":0,"name":"Bundle Output","behaviorType":"logic.NodeGroupOutput","x":900,"y":640,"group":"c368115112be4540","id":"c368115375dc7b41","portId":"c368115112be4540o0","tag":"X","dataType":2},{"inputCount":1,"outputCount":0,"name":"Bundle Output","behaviorType":"logic.NodeGroupOutput","x":900,"y":768,"group":"c368115112be4540","id":"c368115310722f45","portId":"c368115112be4540o1","tag":"Y","dataType":2}],"links":[{"input_id":"c368115375dc7b41i0","output_id":"c36811526918e246o0"},{"input_id":"c368115310722f45i0","output_id":"c36811539b2cf540o0"},{"input_id":"c368115388672342i0","output_id":"c3681153b31db344o0"},{"input_id":"c368115388672342i1","output_id":"c3681153b31db344o0"},{"input_id":"c36811526918e246i1","output_id":"c368115371335448o0"},{"input_id":"c36811526918e246i2","output_id":"c368115371335448o0"},{"input_id":"c36811539b2cf540i1","output_id":"c368115371335448o0"},{"input_id":"c36811539b2cf540i2","output_id":"c368115371335448o0"},{"input_id":"c36811526918e246i0","output_id":"c368115388672342o0"},{"input_id":"c36811539b2cf540i0","output_id":"c368115388672342o0"}]}}}

The code inside is kinda hard to understand, but you don’t need to understand it to use it. Link the angle from the point at to the angle in the bundle, then also input a speed, and it will output a x and y value. Just plug those into the X and Y for the velocity block. This way the forward direction doesn’t matter.

2 Likes

Ok, I’ll try it.

Oh wow. This is really useful. Thanks for the help!