• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

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