Windows enemies follow the player

B

Blade Carrys

Guest
Hello im new on Gm, i working on a similiar game of asteroid but i want to now how can i the enemies follow my player on Gml not dnd, i aprecciate the help, sorry for my english
 

chamaeleon

Member
Hello im new on Gm, i working on a similiar game of asteroid but i want to now how can i the enemies follow my player on Gml not dnd, i aprecciate the help, sorry for my english
Depending on how you implement motion maybe some variations of
GML:
direction = point_direction(x, y, player_instance.x, player_instance.y);
or
GML:
var dir = point_direction(x, y, player_instance.x, player_instance.y);
x += lengthdir_x(enemy_speed, dir);
y += lengthdir_y(enemy_speed, dir);
in the step event of enemies.
 
Top