ShaunJS

animation_end()

Nov 13th, 2018
8,624
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /// @description animation_end(sprite_index,image_index, rate)
  2. /// @param {real} <sprite_index> The index of the sprite being animated
  3. /// @param {real} <image_index> The current frame value
  4. /// @param {real} <rate> -See Below-
  5. ///     The rate of change in frames per step if not
  6. ///     using built in image_index/image_speed.  
  7. ///     Don't use if you don't think you need this.  You probably don't.
  8.  
  9. //returns true if the animation will loop this step.
  10.  
  11. //Script courtesy of PixellatedPope & Minty Python from the GameMaker subreddit discord
  12. //https://www.reddit.com/r/gamemaker/wiki/discord
  13.  
  14. var _sprite=sprite_index;
  15. var _image=image_index;
  16. if(argument_count > 0)   _sprite=argument[0];
  17. if(argument_count > 1)  _image=argument[1];
  18. var _type=sprite_get_speed_type(sprite_index);
  19. var _spd=sprite_get_speed(sprite_index)*image_speed;
  20. if(_type == spritespeed_framespersecond)
  21.     _spd = _spd/room_speed;
  22. if(argument_count > 2) _spd=argument[2];
  23. return _image+_spd >= sprite_get_number(_sprite);
Add Comment
Please, Sign In to add comment