package avs.models;

import avs.utils.Animator;
import avs.utils.Textures;
import avs.ui.MainFrame;

import java.util.ArrayList;
import java.awt.image.*;
import java.awt.*;

import javax.swing.*;

public class Zombie extends Entity{
	private BufferedImage[] animation;
	private int speed;
	private int hp;
	private int damage;

    public Zombie(Textures texx){
        super(117,217,texx);
		this.animation = texx.getZombieWalkingArray();
		this.speed = 1;
		this.hp = 100;
		this.damage = 20;
		anim = new Animator(5,animation);
	}

	public Zombie(double x, double y, Textures texx){
        super(x,y,117,217,texx);
		this.animation = texx.getZombieWalkingArray();
		this.speed = 1;
		this.hp = 100;
		this.damage = 20;
		anim = new Animator(5,animation);
	}

	public void tick(){

		this.x -= speed;



		anim.runAnimation();
	}

	public void render(Graphics g){
		anim.drawAnimation(g,x,y,117,217,0);
	}

	public Rectangle getBounds(){
		return new Rectangle((int) x, (int) y, 150, 150);
	}

	public double getX(){
		return x;
	}
	public void setX(double x){
		this.x = x;
	}

	public double getY(){
		return y;
	}

	public void damageRec(int x){
		this.hp = hp - x;
	}

	public int getHp(){
		return this.hp;
	}

	public int getDamage(){
		return this.damage;
	}

	public void setSpeed(int speed){
		this.speed = speed;
	}

	public synchronized void attack(Plant a){
		a.setHp(a.getHp() - this.damage);
	}
}

@@ -336,16 +336,38 @@
 damage;%0D
+%0A    private int row;%0D
 %0A%0D%0A    p
@@ -581,245 +581,8 @@
 %0D%0A%0D%0A
-%09public Zombie(double x, double y, Textures texx)%7B%0D%0A        super(x,y,117,217,texx);%0D%0A%09%09this.animation = texx.getZombieWalkingArray();%0D%0A%09%09this.speed = 1;%0D%0A%09%09this.hp = 100;%0D%0A%09%09this.damage = 20;%0D%0A%09%09anim = new Animator(5,animation);%0D%0A%09%7D%0D%0A%0D%0A
 %09pub
@@ -623,20 +623,16 @@
 eed;%0D%0A%0D%0A
-%0D%0A%0D%0A
 %09%09anim.r
@@ -718,107 +718,21 @@
 x,y,
-117,217,0);%0D%0A%09%7D%0D%0A%0D%0A%09public Rectangle getBounds()%7B%0D%0A%09%09return new Rectangle((int) x, (int) y, 150, 15
+width,height,
 0);%0D
@@ -1179,15 +1179,286 @@
 mage);%0D%0A
-
 %09%7D%0D
+%0A%0D%0A    public void setRow(int row) %7B%0D%0A        this.row = row;%0D%0A    %7D%0D%0A%0D%0A    public Rectangle getBounds() %7B%0D%0A        int y = Grid.SIDEWALK_OFFSET + this.row * Grid.TILE_HEIGHT;%0D%0A        return new Rectangle((int) this.getX(), y, this.getWidth(), Grid.TILE_HEIGHT);%0D%0A    %7D%0D
 %0A%7D%0D%0A

Fix Zombie bounds.