Advertisement
MichelVGameMaker

animation_hit_frame()

May 18th, 2020
552
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ///@function animation_hit_frame(_end_frame)
  2. /// @description returns true if an animation hits the end of a specific _end_frame – it returns true just before changing to the next frame
  3. /// @param _end_frame
  4.  
  5. var _image_speed = image_speed * sprite_get_speed(sprite_index);
  6. var _type = sprite_get_speed_type(sprite_index);
  7. if ( _type == spritespeed_framespersecond ) _image_speed = _image_speed/game_get_speed(gamespeed_fps);
  8. var _end_frame = argument0;
  9.  
  10. if ( _image_speed == 0 ) return false;
  11. if ( _image_speed > 0  ) return ( image_index + _image_speed >= _end_frame + 1 ) and ( image_index < _end_frame + 1);
  12. else                     return ( image_index + _image_speed <= _end_frame – 1 ) and ( image_index > _end_frame + 1);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement