Rivo
7014
Ok, so i've spent the last few days working on my ai system using different states to tell the enemy what to do, and I am reasonable happy with it so far. Especially considering that i'm completely new to it.
What i'm not so happy about is how the enemy will get way too close and risk it's life to try and kill me D:
So what I'm trying to do make the enemy take cover whenever a solid is near. Here is the code I tried
but I have a feeling that this may be a bit more complex than I know (bear in mind this code was purely just trial and error)
Any help at all would be great, thank you!
What i'm not so happy about is how the enemy will get way too close and risk it's life to try and kill me D:
So what I'm trying to do make the enemy take cover whenever a solid is near. Here is the code I tried
Code:
//when cover is in range, and player is in sight go to cover.
if collision_line(x, y, oPlayer.x, oPlayer.y, oSolid, false, false){
if distance_to_object(oSolid) <= 20{
if distance_to_object(oPlayer) >= radius - 100{
path_end();
if mp_grid_path(pathfinder_grid, path, x, y, oSolid.x, oSolid.y, true){
path_start(path, spd, path_action_stop, false);
}
}
}
}
Any help at all would be great, thank you!