Advertisement
MichelVGameMaker

animation_loop_between()

May 18th, 2020
535
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ///@function animation_loop_between(first_frame, last_frame)
  2. /// @description loop current sprite animation between first_frame and last_frame
  3. /// @param first_frame first frame of the loop
  4. /// @param last_frame last frame of the loop
  5.  
  6. var _image_speed = image_speed * sprite_get_speed(sprite_index);
  7. var _type        = sprite_get_speed_type(sprite_index);
  8. if ( _type == spritespeed_framespersecond ) _image_speed = _image_speed/game_get_speed(gamespeed_fps);
  9. var _end_frame = argument[1];
  10.  
  11. if ( image_speed == 0 ) exit;
  12. if ( image_speed > 0  )
  13. { if ( image_index + _image_speed >= _end_frame + 1 ) image_index = argument[0]; }
  14. else
  15. { if ( image_index + _image_speed <= _end_frame – 1 ) image_index = argument[0]; }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement