J
JoeCruz
Guest
what im trying to accomplish: player presses attack key, creates weapon obj with image_angle pointed towards mouse, and step event rotates it, till alarm event activates and destroys it.
what my code is doing is creating the weapon obj, rotating it and..keeps rotating forever. I might be overlooking something simple. Any help would be much appreciated!
what my code is doing is creating the weapon obj, rotating it and..keeps rotating forever. I might be overlooking something simple. Any help would be much appreciated!
GML:
//weapon_obj create event:
can_rotate = 1;
image_angle = point_direction(x, y, mouse_x, mouse_y); //set to point towards mouse
////////////////////////////////////////////////////
// Weapon_obj step event:
if (can_rotate == 1)
{
image_angle -= 4; // "animation"
alarm[0] = 4;
}
move_towards_point(player_obj.x,player_obj.y,10); //Sticks to the player
////////////////////////////////////////////////////////
//weapon_obj alarm[0] event:
instance_deactivate_object(self);
//////////////////////////////////////////////////////////////////
//weapon_obj draw event:
draw_self();