image_angle


Description

This value sets the angle (rotation) of the sprite and is measured in degrees, with the right being 0º, up being 90º, left being 180º and down being 270º. Set this variable to 0 to reset the sprite to be drawn as was defined in the sprite editor. Please note that for changes in this variable to be visible, the instance should have either no draw event (and so GameMaker Studio 2 will default draw the sprite) or be drawn using one of the extended drawing functions like draw_self() or draw_sprite_ext().


Syntax:

image_angle;


Returns:

Real


Example:

image_angle = point_direction(x, y, mouse_x, mouse_y);

The above code will rotate the sprite of the instance to always point at the mouse position.