B
bryann109
Guest
I can't figure out what is wrong with this code. Searched the forum and couldn't find anything related to my situation. Sprites are 64x64 with middle center origin.
First, in the Create event of my controller (oCtrl)...
Next, when a bot object (oBot) spawns in the room, in its Create event...
gspeed is used as part of path_start(). In oBot's Alarm 0 event...
For some reason, oBot refuses to move. Coordinates 160,160 does not have a wall object. Bots can only move to empty cells. I even tried setting room_width and room_height in oCtrl to /64, but I get the same result regardless. Something is preventing oBot from following its given path. But what?
First, in the Create event of my controller (oCtrl)...
Code:
global.mpgrid = mp_grid_create(0,0,room_width/32,room_height/32,64,64);
mp_grid_add_instances(global.mpgrid,oWall,false);
Code:
gspeed = 2;
botpath = path_add();
alarm[0] = 1;
Code:
mp_grid_path(global.mpgrid,botpath,x,y,160,160,false);
path_start(botpath,gspeed,2,false);