Advertisement
pontoevirgula

Fim da Animação

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