Crysillion
Member
I'm essentially trying to create an object that sort of "magnetizes" to the player object. After a certain radius, the object begins to slowly but surely gravitate towards the player. The closer the object is to the player, the faster its speed is.
What I have right now is:
Which I know would begin to move this object towards o_player once o_player is within 100 distance. However, this would move at full speed as soon as the radius is breached. How can I make it so its speed depends on how far away the player is, as described above?
What I have right now is:
Code:
if (distance_to_object(o_player) < 100) {
direction = point_direction(x,y,o_player.x,o_player.y);
speed = 1;
}