package com.norwand.game.management.gamedata.environement.entities.monsters;

import com.badlogic.gdx.graphics.Pixmap;
import com.norwand.game.management.gamedata.GameData;
import com.norwand.game.management.gamedata.environement.Floor;
import com.norwand.game.management.gamedata.environement.entities.Monster;
import com.norwand.game.resources.ImagesHolder;
import com.norwand.game.utility.objects.DoubleRectangle;
import com.norwand.game.utility.objects.MathVector;
import com.norwand.game.utility.objects.Position;

/**
 * Created by V-SSK on 17/05/2016.
 */
public class DevilEye extends Monster {
    public DevilEye(Floor roompointer, double x, double y) {
        super(roompointer, x, y);
    }
    private int nextjumpin = 175;
    private int spritecounter = 10;
    private MathVector jumpdirection;

    @Override
    public void update() {
        --nextjumpin;
        if(nextjumpin == 0){
            jumpdirection = new MathVector(GameData.get().player.x - posX, GameData.get().player.y - posY);
        }else if(nextjumpin < -20){
            nextjumpin = 175;
        }
        if (nextjumpin < 0){
            Position temp = jumpdirection.getFixedTranslation(posX, posY, 0.08);
            if (canBeAt(temp.x, temp.y)) {
                posX = temp.x;
                posY = temp.y;
            }
        }
        --spritecounter;
        if (spritecounter < 0)
            spritecounter = 50;
        if(knockback())
            GameData.get().player.info.health -= 0.5;

    }

    @Override
    public Pixmap getCurrentSprite() {
        if(nextjumpin < 0)
            return ImagesHolder.entityset.getTile(794);
        return ImagesHolder.entityset.getTile((spritecounter < 25) ? 786 : 794);
    }

    @Override
    public void onAct() {

    }

    @Override
    public DoubleRectangle getHitbox(double posX, double posY) {
        return new DoubleRectangle(posX - 0.35, posY - 0.35, 0.7, 0.7);
    }

    @Override
    public void onhit(double damage) {
    kill();
    }
}

@@ -701,42 +701,8 @@
   %7D%0A
-    private int nextjumpin = 175;%0A
     
@@ -756,20 +756,16 @@
 hVector 
-jump
 directio
@@ -809,24 +809,25 @@
 ate() %7B%0A
+%0A
         
 --nextju
@@ -822,67 +822,8 @@
     
---nextjumpin;%0A        if(nextjumpin == 0)%7B%0A            jump
 dire
@@ -922,102 +922,42 @@
     
-%7Delse if(nextjumpin %3C -20)%7B%0A            nextjumpin = 175;%0A        %7D%0A        if (nextjumpin %3C 0
+if (direction.getBasicLength() %3C 4
 )%7B%0A 
@@ -983,20 +983,16 @@
  temp = 
-jump
 directio
@@ -1029,62 +1029,37 @@
 sY, 
-0.08);%0A            if (canBeAt(temp.x, temp.y)) %7B%0A    
+(spritecounter%3E33)?0.1:0.8);%0A
     
@@ -1093,20 +1093,16 @@
         
-    
 posY = t
@@ -1112,22 +1112,8 @@
 .y;%0A
-            %7D%0A
     
@@ -1114,24 +1114,25 @@
 ;%0A        %7D%0A
+%0A
         --sp
@@ -1169,24 +1169,25 @@
 ecounter %3C 0
+ 
 )%0A          
@@ -1204,17 +1204,17 @@
 unter = 
-5
+4
 0;%0A     
@@ -1283,16 +1283,17 @@
 th -= 0.
+2
 5;%0A%0A    
@@ -1352,91 +1352,8 @@
 ) %7B%0A
-        if(nextjumpin %3C 0)%0A            return ImagesHolder.entityset.getTile(794);%0A
     

Change Devileye