Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package gamePackage;
- import org.newdawn.slick.Image;
- import org.newdawn.slick.SlickException;
- import org.newdawn.slick.SpriteSheet;
- public class BasicHeal extends Skill{
- private int state=0;
- private long startTime=0;
- private long upToTime=0;
- AnimationController healing;
- String slimeStanding="slimeStanding",plusses="plusses",ray="ray";
- public BasicHeal(){
- super(16,0);
- type = SUPPORT;
- try {
- healing= new AnimationController(new SpriteSheet("Sprites/SupportAnimationW64H64.png",64,64,0));
- healing.addAnimation(slimeStanding, 0, 0, new int[] {100000});
- healing.addAnimation(plusses, 0, 1, new int[] {10,10,10,10,10,10});
- healing.addAnimation(ray, 0, 2, new int[] {10,10,10,10,10,10,10,10,10});
- } catch (SlickException e) {
- e.printStackTrace();
- }
- }
- @Override
- public int action(Mob player, Mob opponent) {
- upToTime=System.currentTimeMillis();
- if(state == 0){
- state = 1;
- startTime = System.currentTimeMillis();
- }else if(state ==1 && Math.abs(startTime-upToTime)>1500){
- player.heal(Math.round(player.getHeal()));
- state = 0;
- reset();
- }
- return state;
- }
- @Override
- public void draw(Mob player, Mob opponent){
- System.out.println("drawing...");
- if(state ==1){
- if(Math.abs(startTime-upToTime)<=900){
- healing.animate(ray, false).draw(Main.WIDTH/2, Main.HEIGHT/2);
- }
- healing.animate(slimeStanding, false).draw(Main.WIDTH/2, Main.HEIGHT/2, player.col);
- if(Math.abs(startTime-upToTime)>=1000 && Math.abs(startTime-upToTime)<=1500){
- healing.animate(plusses, false).draw(Main.WIDTH/2, Main.HEIGHT/2);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement