【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:

Top 3 UX Design Articles of 2024 to Remember

Based on most subscriptions ͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­...

Contact Form

Name

Email *

Message *