Can someone PLEASE tell me how to make a enemy ai

i’m thinking about adding a enemy to my game can someone give me a hand? :neutral_face:

2 Likes
2 Likes

3 Likes

Do that to the enemy and rezise proximity

3 Likes

Basically, Si-Guy made a thing that says:
If the player is close to me, extract my X position and their X position. If they’re X position is greater (they’re ahead of me), then set velocity to 4. Otherwise, set it to negative four.

Another good step to take:
Take out a Logic Gate. Switch it to NOR. Attach it to the X of the proximity. Attach a number (keep it at zero) to that NOR gate. Attach the number to the velocity and the Back of the flip.
Basically, NOR gates get triggered when nothing is triggering them. Confused? Let’s say you put a nor gate on the proximity. When the proximity senses something, it’ll trigger all things attached. However, if it isn’t currently sensing something, it won’t trigger anything BUT the NOR gate (and other logic gates, but you’ll learn that later), which makes the NOR gate get the number, which sets the velocity to 0. Basically, if the player isn’t nearby, just stop moving.

Also, you can remove that extract on the bottom and just put the X of the proximity in the Value of the filter. Also, set the proximity to whatever your player sprite is.

3 Likes

okay i’ll do it. it will take long though :slightly_smiling_face:

2 Likes

this helps a lot can i implement this as a stealth kind of idea??

1 Like

I can make one for you if you like

This is 2 years old, it’s best not to bring this post back up, as it pushes newer posts down. But welcome to Flowlab! (And whatever it is you’re looking for can probably be implemented in a stealth game)

1 Like