Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

The Gatrex AI, an multiplayer adaptator

The Gatrex AI is an AI i maked, the name is because the first succsesfull test was on megamiaut the space asalt(link:https://gatorium-games.itch.io/megamiaut-the-space-asalt) on the world 2 bosfight, the boss is an Gatrex, an Gatroid more advanced and powerfull than normal, the AI make's the object we are aplying it to be able to calculate the more nearest object, like P1 and P2, here is the code of Gatrex AI type 1:

if distance_to_object(obj1) < distance_to_object(obj2)

{

 d = 1

}

else

if distance_to_object(obj1) > distance_to_object(obj2)

{

 d = 2 the variable d make that you can export this variable to other object's or use other code's without repeating it

}

 obj1(like P1) mean's the first object you want to difference the distance from obj2(like P2)

Change obj1 for your first object and obj2 for your second object.

this code was tested on gamemaker 8.1, I don't now if it can be used for more advanced versions.

The Gatrex AI type 2 code's make that it only work's if the object distance is less than the max

if distance_to_object(obj1) < distance_to_object(obj2) and distance_to_object(obj1) < (max_distance)

{

 d = 1

}

else

if distance_to_object(obj1) > distance_to_object(obj2) and distance_to_object(obj2) < (max_distance)

{

 d = 2

}

else

{

 d = 0

}

You can make that d = 0 mean's something, like to go to it's spawn spot with the variable's that I call "the spawn memory", is using variable's that I choose'd the letter's k and l, but you can use other letter's too, only make that in create event put this code, k = x    l = y, but sepparated.

Support this post

Did you like this post? Tell us

In this post

Leave a comment

Log in with your itch.io account to leave a comment.

SI les sirve el termino, diganme, puede que sea para una versión vieja, pero sirve.

Umm... What DU heck.

(1 edit)

You can use this code for your game's, for whatever you want, is not necesary to use it to follow player's, you can make that something of it change, like a command or whatever you want.

Mentioned in this post