【GameMaker】 Gradually rotating an object towards a target

Information about object: obj_projectile
Sprite: spr_projectile
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask:
No Physics Object
Step Event:
execute code:

var dir = point_direction(x, y, mouse_x, mouse_y);
var angle = angle_difference(image_angle, dir);
if abs(angle)<=25
{
image_angle -= angle;
}
Draw Event:
execute code:

draw_self();
draw_text(x-100,y,image_angle);

No comments:

This will make you a better decision maker | Annie Duke (author of “Thinking in Bets” and “Quit”, former pro poker…

Annie is a former professional poker player, decision-making expert, author, and special partner at First Round Capital.  ͏     ­͏     ­͏   ...

Contact Form

Name

Email *

Message *