jobjorgos
Member
Hey,
I have a boss that chases the player and that went pretty good with the following script:
But the small problem now is that whenever the boss is straight at where the player is, it is gonna flick which look really stupid. It should be more smooth or just flick less around by standing more still.
I did some research and I found this could be a solution:
This indeed solved the flicking problem, it just stands still whenever it is straight at the players position which is nice!
But now the problem is that whenever the boss is on the same Y height as the player, that the boss object stop following the player.
When the boss is on the same X width as the player, it just works and it keeps following/chasing the player.
Is there anyway I can improve this code to prevent this? Thanks!
I have a boss that chases the player and that went pretty good with the following script:
Code:
if gofollow == true{
move_towards_point( obj_player.x, obj_player.y, 9 );
}
I did some research and I found this could be a solution:
Code:
if gofollow == true{
if abs(obj_player.x-x)<5
{
speed=0;
}else{
move_towards_point( obj_player.x, obj_player.y, 9 );
}
if abs(obj_player.y-y)<5
{
speed=0;
}else{
move_towards_point( obj_player.x, obj_player.y, 9 );
}
}
But now the problem is that whenever the boss is on the same Y height as the player, that the boss object stop following the player.
When the boss is on the same X width as the player, it just works and it keeps following/chasing the player.
Is there anyway I can improve this code to prevent this? Thanks!
Last edited: