OmegaGamingHunters

Animating sprites

Jan 31st, 2021
872
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. if (_bullet.AnimSpeed > 0)
  2. {
  3.     var _spr_frames = sprite_get_number(_bullet.Sprite); //Number of frames in the current Bullet Sprite.
  4.     var _spr_animSpeed = sprite_get_speed(_bullet.Sprite) * (_bullet.AnimSpeed);
  5.     var _spr_gameframe = spritespeed_framespergameframe;
  6.     var _spr_conditional_1 = (sprite_get_speed_type(_bullet.Sprite) == _spr_gameframe);
  7.     var _spr_conditional_2 = _spr_animSpeed / game_get_speed(gamespeed_fps);
  8.     var _spr_spriteIndex = (_spr_conditional_1 ? _spr_animSpeed : _spr_conditional_2);
  9.                
  10.     _bullet.Sprite_Index += (_spr_spriteIndex mod _spr_frames);
  11. }
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×