so i am making a horror game and i just need to detect when its path is over so it can update the follow to a new place, my game is oriented by different rooms, and i need a way to check on all instances of an object to check an variable that contains its center so the monster can make the path to that place , and after reaching that place select another place so he is moving all the time can anyone help?
#Help with enemy AI
7 messages · Page 1 of 1 (latest)
var inst = instance_place(x, y, oPinarea);
if cpt-- <= 0 {
cpt = cpd;
var foundtarget = mp_grid_path(global.mpgrid, path, x, y, target.x, target.y, true);
if foundtarget {
path_start(path, vel, path_action_stop, true);
}
}
if !inst == oPlayer.player_inst {
if path_position == 1 {}
}
}```
thats the monster step
hey. its quite unclear whats wrong and what do you need help with. i mean the question itself is the only thing clear here.
my game is oriented by different rooms, and i need a way to check on all instances of an object to check an variable that contains its center
no idea what any of that means, could you rephrase if thats important?
your code is also a little junky but it looks like its selecting a path and then uses it. i havent used the paths system in gamemaker, does it use that?
in any case, following your actual question, it seems like you are looking to create some kind of system that noticed when the monster is done with its current path and then moves on to select a new path automatically, is that correct?
well, about the code for the path tracing is something i got from a video and i dont understand it well, its the first time i use path tracing
but in less words, i wanna like check when the path is over and then pick a random instance of a single object to get the center of where to move next
cuz is like a top down game, and i want like the monster to be able to be moving contantly from room to room while respecting the colliders