package Entity;

import java.util.List;

import End.Screen;
import End.Sprite;

public class Monster extends Mob {

	private int ticks = 0;
	
	public Monster(int x, int y){
		this.x = x << 4;
		this.y = y << 4;
		sprite = Sprite.monsterLeft1Sprite;
	}
	public void update(){
		++ticks;
		move();		
	}
	public synchronized void move(){
		int xa = 0, ya = 0;
		List<Player> players = level.getPlayers(this, 60);
		if(players.size() > 0){
			Player player = level.getFirstPlayer();
		if(player.x - x > 0){
			xa++;
			dir = 1;
			
		} else if (player.x - x < 0){
			xa--;
			dir = 3;
		}
		if(player.y - y > 0){
			ya++;
			dir = 2;
			
		}else if(player.y - y < 0){
			ya--;
			dir = 0;
		}
		if(xa != 0 || ya != 0){
			move(xa,ya);
			return;
		}
		}
}
	public boolean solid(){
		return true;
	}
	public void render(Screen screen){
		if(dir == 0) { 
				if(ticks  % 30 < 15)
					sprite = Sprite.monsterFrontSprite;
				else
					sprite = Sprite.monsterFront1Sprite;
		}
		if(dir == 1) {
				if(ticks % 30 < 15)
					sprite = Sprite.monsterRightSprite;
				else
					sprite = Sprite.monsterRight1Sprite;
		}
		if(dir == 2) {
		
				if(ticks % 30 < 15)
					sprite = Sprite.monsterBackSprite;
				else
					sprite = Sprite.monsterBack1Sprite;
		}
		if(dir == 3) {
				if(ticks % 30 < 15)
					sprite = Sprite.monsterLeftSprite;
				else
					sprite = Sprite.monsterLeft1Sprite;
			
		}
		screen.renderMob((int)x, (int)y , sprite);
	}
	public double distance(Player player){
		
		double distance = Math.sqrt((player.x - x ) * (player.x - x  ) + (player.y - y ) * (player.y - y ) );
		return distance;
	}
}

@@ -144,18 +144,39 @@
  = 0;%0D%0A%09
+private int hp = 100;
 %0D%0A
-
 %09public 
@@ -306,16 +306,563 @@
 ate()%7B%0D%0A
+%09%09if(Player.alive && level.getFirstPlayer().getWin() == false)%7B%0D%0A%09%09%09if(x %3E= level.getFirstPlayer().getX() - 16 && x %3C= level.getFirstPlayer().getX() + 16 && y %3E level.getFirstPlayer().getY()- 32 && y %3C level.getFirstPlayer().getY() + 32)%7B%0D%0A%09%09%09%09System.out.println(%22Collision%22 + level.getFirstPlayer().getX() + %22 %22 + x);%0D%0A%09%09%09%09double val = Math.atan2(level.getFirstPlayer().getY() - y,level.getFirstPlayer().getY() - y );%0D%0A%09%09//%09%09val /=3;%0D%0A%09%09%09//%09System.out.println(val);%0D%0A%09%09%09%09//x = (int)(val * x);%0D%0A%09%09%09//%09y = (int)(val * y);%0D%0A%09%09%09%09//%5D%09y -= 32;%0D%0A%09%09%09%7D%0D%0A%09
 %09%09++tick
@@ -865,16 +865,17 @@
 ticks;%0D%0A
+%09
 %09%09move()
@@ -879,20 +879,29 @@
 e();%09%09%0D%0A
+%09%09%09%7D%0D%0A
 %09%7D%0D%0A
+%09%0D%0A
 %09public 
@@ -998,16 +998,17 @@
 s(this, 
+1
 60);%0D%0A%09%09
@@ -1106,18 +1106,21 @@
 %7B%0D%0A%09%09%09xa
-++
+ += 2
 ;%0D%0A%09%09%09di
@@ -1170,18 +1170,21 @@
 %7B%0D%0A%09%09%09xa
---
+ -= 2
 ;%0D%0A%09%09%09di
@@ -1226,18 +1226,21 @@
 %7B%0D%0A%09%09%09ya
-++
+ += 2
 ;%0D%0A%09%09%09di
@@ -1292,10 +1292,13 @@
 %09%09ya
---
+ -= 2
 ;%0D%0A%09
@@ -2091,24 +2091,24 @@
 rite);%0D%0A%09%7D%0D%0A
+
 %09public doub
@@ -2136,20 +2136,16 @@
 ayer)%7B%0D%0A
-%09%09%0D%0A
 %09%09double

Update Monster.java