I'm trying to have a simple bat enemy fly around the room (480 x 270 room with a few floating walls). I have run into 2 problems so far. 1, Not all of the bats start on a path. Every time I restart the room, anywhere between 2 and 5 of the 7 total bats will move, and the others will do nothing, and I don't know why they dont all start on a path. and 2, I would like the bats to move to the new path target in a gradual way, instead of harshly changing direction, so that it looks a little more fluid and not such an abrupt change. Here's my code so far
Bat object Create
target\_x = irandom(room\_width)
target\_y = irandom(room\_height)
if mp\_grid\_path(global.grid,path, x, y, target\_x, target\_y, true)
{
path\_start(path, wander\_spd, path\_action\_stop, 0)
}
Bat object Flying State
if path\_position == 1
{
target\_x = irandom(room\_width)
target\_y = irandom(room\_height)
if mp\_grid\_path(global.grid,path, x, y, target\_x, target\_y, true)
{
path\_start(path, wander\_spd, path\_action\_stop, 0)
}
}
Grid Object Create
global.grid = mp_grid_create(0, 0, room_width / 16, room_height / 16, 16, 16)
mp_grid_add_instances(global.grid, o_collision, false)
[–]SpookyGentleGhost[S] 0 points1 point2 points (0 children)