hdarren
Member
I am making a top down shooter like Hotline Miami and there is a flying drone enemy that flies around. I want it to move towards the player but I want the direction it moves in to change slowly instead of abruptly.
What I have tried is to use point_direction() to get the direction of the drone to the player. I then compare it to the drone's current direction and increase/decrease the direction towards the intended direction.
I am having a specific problem though when it moves to the right due to how point_direction() works. For example if the current direction of the drone is 10 and the point_direction() is 350 then the drone's direction will increase to try to reach 350, but what it should do instead is decrease and wrap around from 0 to 360.
How do I perform this wrapping around correctly?
Thank you.
What I have tried is to use point_direction() to get the direction of the drone to the player. I then compare it to the drone's current direction and increase/decrease the direction towards the intended direction.
I am having a specific problem though when it moves to the right due to how point_direction() works. For example if the current direction of the drone is 10 and the point_direction() is 350 then the drone's direction will increase to try to reach 350, but what it should do instead is decrease and wrap around from 0 to 360.
How do I perform this wrapping around correctly?
Thank you.