How to make ai shoot each other?

I’m making a battle royal game and I want the bots to shoot each other but I do not know how.
The bots already move around I just need them to shoot each other.

I know once the first project i worked on was a tank shooter game, look at that example you will how to produce those bullets, then just add an event which changes the angle towards your specified object you can also add an object variable to be more specific with which instance of that object you want to target!

(There’s 100 enemy’s) here is an example of what I want to do:
1 will point at the closest object that is the same as its self(enemy), but not its self.
If number 1 is closer to 2 than 3 aim at 2, and if 2 is closer to 3 than 2 aim at 3. but I think my problem is that there all the same objects (I don’t want to make every individual object and individual event for each object because that will lag ALOT.) and I also don’t know how to make a variable for each object. @Prajwalraut

Hmm… you are planning to keep those objects/enemies in frame from starting or you are going to create them while the game is running?!

When you start the game there already there, in the exact spots as the last time you loaded.

1 Like





Ok so now by looking at the events you can get idea on how you can approach your problem, however if nothing makes sence here to you i suggest you to try out tutorials from gdevelop website, where everything is given step by step!
here i am just changing animation but you can do anything instead of this(shooting, etc)!
any questions regarding above tell me!

so I kinda get this but do I have to do this for each 1/100 enemy’s.

Not at all, put as many as enemies you want it will still work great, here i have made team 1 and team 2, this script is making team 1 change the animation of team 2, you can do it the other way too so that the team 2 also effects team 1, you can delete that object instead of changing animation

Also what if I want it to be FFA (free for all) how would I do that? or is that even possible?
@Prajwalraut

Even though it’s been awhile since the last time we contacted, I still need help making the bots ffa.

Sorry , what do you mean by making bots free for all?How do you want them to behave?