Advertisement
Guest User

Untitled

a guest
Nov 27th, 2014
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.60 KB | None | 0 0
  1. package gamePackage;
  2.  
  3. import org.newdawn.slick.Image;
  4. import org.newdawn.slick.SlickException;
  5. import org.newdawn.slick.SpriteSheet;
  6.  
  7. public class BasicHeal extends Skill{
  8. private int state=0;
  9. private long startTime=0;
  10. private long upToTime=0;
  11. AnimationController healing;
  12. String slimeStanding="slimeStanding",plusses="plusses",ray="ray";
  13.  
  14. public BasicHeal(){
  15. super(16,0);
  16. type = SUPPORT;
  17. try {
  18. healing= new AnimationController(new SpriteSheet("Sprites/SupportAnimationW64H64.png",64,64,0));
  19. healing.addAnimation(slimeStanding, 0, 0, new int[] {100000});
  20. healing.addAnimation(plusses, 0, 1, new int[] {10,10,10,10,10,10});
  21. healing.addAnimation(ray, 0, 2, new int[] {10,10,10,10,10,10,10,10,10});
  22. } catch (SlickException e) {
  23. e.printStackTrace();
  24. }
  25. }
  26.  
  27. @Override
  28. public int action(Mob player, Mob opponent) {
  29. upToTime=System.currentTimeMillis();
  30. if(state == 0){
  31. state = 1;
  32. startTime = System.currentTimeMillis();
  33. }else if(state ==1 && Math.abs(startTime-upToTime)>1500){
  34. player.heal(Math.round(player.getHeal()));
  35. state = 0;
  36. reset();
  37. }
  38.  
  39. return state;
  40. }
  41. @Override
  42. public void draw(Mob player, Mob opponent){
  43. System.out.println("drawing...");
  44. if(state ==1){
  45. if(Math.abs(startTime-upToTime)<=900){
  46. healing.animate(ray, false).draw(Main.WIDTH/2, Main.HEIGHT/2);
  47. }
  48. healing.animate(slimeStanding, false).draw(Main.WIDTH/2, Main.HEIGHT/2, player.col);
  49. if(Math.abs(startTime-upToTime)>=1000 && Math.abs(startTime-upToTime)<=1500){
  50. healing.animate(plusses, false).draw(Main.WIDTH/2, Main.HEIGHT/2);
  51. }
  52. }
  53.  
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement