enemys following you or going to an object

please help. No other way to describe

There are 2 easy ways to make a chase command-

But heres one, ill tell you the other one if this just doesn’t fit the bill. If you want an object to chase you, but also face the player (works best as a top down enemy, or a homing missile), you grab a switch, an always, a proximity, a velocity, a number, and a pointat. Set up the proximity up to your desired range and target and uncheck the ‘only trigger once’ connect the x/y to the pointat’s x/y, then make the proximity turn on the switch, hook up the always to the switch imput, make the switch go into a number with a desired speed. Take the number output and bring it to the velocitys forward input hook. DONE!

If your sprite by default faces any other direction than right, you can always change that in the properties! Happy logic-building!! \\(^^)//

works perfectly but, is there a way to disable chasing after you’re out of reach, and go onto random movement. I know how to do random movement but I want there to be a way to switch between the two.

Is there also a way to make enemies run away from other enemies?

Well. No…

Unless… You use a certain way, but it involves both of the logic builds and no longer uses a velocity, but a motor… Want to use that one?

How would I do so?

Okay, so you want another proximoty, 2 extractors, 2 expressions, 4 numbers, 2 filters,

Take the proximity, set to a enemy you want it to avoid, uncheck only trigger once, and select the range.

Take the two extractors set one to X, and the other one Y.
Take the X extractor and plug into the b slot in ONE expression. Take the proximity and plug the X to the A slot on that same expression, also plug the X into the expressions EVAL.

In BOTH expression menus, put A-B, and plug it into a filter, leave it at greater than 0, then plug the PASS output to a number thats negative, and the FAIL output positive, and plug it into the motors X, if its opposite to what you want, flip it.

For Y repeat, but replace all the Xs in the paragraph with Ys.

Note that a positive in the Y goes down…

As for chasing the player, keep it the same but use the motor forward.

Please note that you might want to add drag to the object properties, and keep the number relatively low…

Thanks, It’s working out good!