mafon2
Member
I followed two of the most popular tutorials about pathfinding and got the amazing results I've been trying (with horrible results) to write algorithms for. Didn't know there's already built in stuff. But for some reason the grid instances appear shifted 16p down and 16p right, plus sometimes the skeleton is smashing into the walls. I think it's something to do with the sprite origins, 'cause when I center it, the skeletons move better (yet still too "fluidly" for my taste and blurry for some reason).
The code on the skeleton is:
(Don't know if moveTimer does anything... added it for more "square" movement)
The code for grid is:
Is it like I need to add "+16" part to mp_grid_create?
My sprites' origins are set to default 0,0 and grid's drawn from 0,0. I don't get why's it shifted. And that's the question . BTW, would be gratefull to get the answer to how to make monsters move like in old arcade games "crisp pac man style".
P.S. And with the simplest: [mp_potential_step(obj_digger.x,obj_digger.y,2,true);] monsters have troubles squizing through minimal 32p gap.
P.P.S. Making my Digger Game.
-------------------------------
Oh, and while we're at it.
How to fill this global.grid with instances? (So I don't place every dirt block manualy)
The code on the skeleton is:
Code:
path = path_add();
mp_grid_path(global.grid,path,x,y,obj_digger.x,obj_digger.y,0);
path_start(path,2,"",0);
moveTimer = global.cell_size;
The code for grid is:
Code:
global.grid = mp_grid_create(0,0, room_width div 32, room_height div 32, 32, 32);
mp_grid_add_instances(global.grid, obj_block, false);
My sprites' origins are set to default 0,0 and grid's drawn from 0,0. I don't get why's it shifted. And that's the question . BTW, would be gratefull to get the answer to how to make monsters move like in old arcade games "crisp pac man style".
P.S. And with the simplest: [mp_potential_step(obj_digger.x,obj_digger.y,2,true);] monsters have troubles squizing through minimal 32p gap.
P.P.S. Making my Digger Game.
-------------------------------
Oh, and while we're at it.
How to fill this global.grid with instances? (So I don't place every dirt block manualy)
Last edited: