J
jaakko meyn
Guest
I have an enemy that Is moving towards a randomly generated point above the player, but I cant seem to get it to stop when reaching the destination point (the object does stop, but it still tries to move causing the sprite to twitch, which is the actual problem here)
here is the movement code
my aim is to make it stop when reaching the player position + random_x/y, but nothing ive tried works
Im still quite new to Gamemaker and ive heard that I shouldnt move physics objects with the phy_position variable nut instead use impulses, so getting some advice for that would be helpful too
here is the movement code
Code:
dir = point_direction(phy_position_x,phy_position_y,obj_player.phy_position_x - random_x,obj_player.phy_position_y - random_y)
phy_position_x = phy_position_x + lengthdir_x(randomspeed,dir)
phy_position_y = phy_position_y + lengthdir_y(randomspeed, dir)
Im still quite new to Gamemaker and ive heard that I shouldnt move physics objects with the phy_position variable nut instead use impulses, so getting some advice for that would be helpful too