Guest User

Untitled

a guest
Mar 4th, 2015
314
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.60 KB | None | 0 0
  1. class Kirillentity : Mob
  2. {
  3.     MobState state;
  4.    
  5.     Animation idle;
  6.     Animation move;
  7.     Animation attack;
  8.     Sprite[] idleFrames;
  9.     Sprite[] moveFrames;
  10.     Sprite[] attackFrames;
  11.    
  12.     update(deltaTime)
  13.     {
  14.         if (state == ATTACK)
  15.         {
  16.             if (attack.update(deltaTime)) // Если анимация атаки завершилась
  17.             {
  18.                 state = IDLE;
  19.             }
  20.         }
  21.     }
  22.    
  23.     draw(sb)
  24.     {
  25.         if (state == IDLE) sb.drawSprite(idleFrames[idle.currentFrameIndex]);
  26.         if (state == MOVE) sb.drawSprite(moveFrames[move.currentFrameIndex]);
  27.         if (state == ATTACK) sb.drawSprite(attackFrames[attack.currentFrameIndex]);
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment