KPJ
Member
Hi! In my top down game my enemies use a grid system to follow the player and avoid objects. However, while my enemy is chasing the player the way the enemy is facing is very choppy (it glitches between 2-3 different angles). How can I make it so that the enemy smoothly looks toward the direction that it is moving?
Code:
Any idea how to do this or whats going wrong? Thanks!
Code:
Code:
//oGrid Create event
var cellwidth = 32;
var cellheight = 32;
var hcells = room_width div cellwidth;
var vcells = room_height div cellheight;
global.grid = mp_grid_create(0, 0, hcells, vcells, cellwidth, cellheight);
//Add the things to avoid
mp_grid_add_instances(global.grid, oSolid, false);
//oEnemy Create event
path = path_add();
//oEnemy follow player script
var mx = (oPlayer.x div 32) * 32 + 16;
var my = (oPlayer.y div 32) * 32 + 16;
if (mp_grid_path(global.grid, path, x, y, mx, my, 1))
{
path_start(path, enemyspd, path_action_stop, false);
}