// Path: src/main/java/utilties/entities/Empty.java
// public class Empty extends Entity {
// 
// 
//     /**
//      * Empty Entity.  Placed in a tile without any Objects
//      */
//     public Empty(Point location) {
//         this.location = location;
//         this.entityType = EntityType.EMPTY;
//     }
// 
// }
// 
// Path: src/main/java/utilties/entities/Entity.java
// public abstract class Entity {
// 
//     protected EntityType entityType = null;
// 
//     protected Point location;
// 
//     /*
//     Entity Type enum
//      */
//     public enum EntityType {
//         EMPTY, PLAYER
//     }
// 
// 
//     public void setLocation(Point location) {
//         this.location = location;
//     }
// 
//     public Point getLocation() {
//         return this.location;
//     }
// 
//     public EntityType getEntityType() {
//         return this.entityType;
//     }
// 
// 
// }
// 
// Path: src/main/java/utilties/entities/Player.java
// public class Player extends Entity {
// 
//     private int id;
//     private int health;
//     private int damage;
//     private boolean isShielding;
//     private int shieldStrength;
// 
//     /**
//      * @param id       Player ID
//      * @param location Location of where Player will be added
//      */
//     public Player(int id, Point location) {
//         this.id = id;
//         this.health = 100;
//         this.damage = 10;
//         this.location = location;
//         entityType = EntityType.PLAYER;
//         this.isShielding = false;
//         this.shieldStrength = 5;
//     }
// 
//     /**
//      * Get the ID of the player
//      *
//      * @return ID of player
//      */
//     public int getId() {
//         return this.id;
//     }
// 
//     /**
//      * Get health of Player
//      *
//      * @return Health of Player
//      */
//     public int getHealth() {
//         return this.health;
//     }
// 
// 
//     /**
//      * Set health of player
//      *
//      * @param health Health to change to
//      */
//     public void setHealth(int health) {
//         this.health = health;
//     }
// 
// 
//     public int getDamage() {
//         return damage;
//     }
// 
//     public void setDamage(int damage) {
//         this.damage = damage;
//     }
// 
// 
//     public boolean isShielding() {
//         return isShielding;
//     }
// 
//     public void setShielding(boolean shielding) {
//         isShielding = shielding;
//     }
// 
//     public int getShieldStrength() {
//         return shieldStrength;
//     }
// 
//     public void setShieldStrength(int shieldStrength) {
//         this.shieldStrength = shieldStrength;
//     }
// 
// }


import org.mapeditor.core.Map;
import org.mapeditor.core.MapLayer;
import org.mapeditor.core.Tile;
import org.mapeditor.core.TileLayer;
import utilties.entities.Empty;
import utilties.entities.Entity;
import utilties.entities.Player;
import java.awt.*;
import java.util.ArrayList;
    private TileLayer getPlayerLayer() {
        ArrayList<MapLayer> layerList = new ArrayList<>(this._gameMap.getLayers());
        return (TileLayer) layerList.get(2);
    }


    /**
     * Moves location of EntityTile to new location.  This updates both Tiled's TileMap and well as our custom game map.
     * If the location to move to is occupied, the EntityTile stays in its current location, or if location is outside of player bounds
     *
     * @param entity           Entity to move
     * @param locationToMoveTo Location to move to
     * @return If EntityTile can move to that location
     */
    public boolean setLocation(EntityTile entity, Point locationToMoveTo) {

        //If outside of player bounds return false
        if (!isInsideMap(locationToMoveTo)) {
            return false;
        }

        //All movement is done on the player layer.  We need to grab a couple of references before we can move location.
        TileLayer playerLayer = getPlayerLayer();
        //Get the current location of the entity
        Point entityCurrentLocation = new Point(entity.getLocation());
        //Reference to the tile the player will be moving to
        EntityTile tileToMoveTo = _entityTiles[locationToMoveTo.x][locationToMoveTo.y];


        //If the tile to move to is empty, then it is a valid move
// Path: src/main/java/utilties/entities/Empty.java
// public class Empty extends Entity {
// 
// 
//     /**
//      * Empty Entity.  Placed in a tile without any Objects
//      */
//     public Empty(Point location) {
//         this.location = location;
//         this.entityType = EntityType.EMPTY;
//     }
// 
// }
// 
// Path: src/main/java/utilties/entities/Entity.java
// public abstract class Entity {
// 
//     protected EntityType entityType = null;
// 
//     protected Point location;
// 
//     /*
//     Entity Type enum
//      */
//     public enum EntityType {
//         EMPTY, PLAYER
//     }
// 
// 
//     public void setLocation(Point location) {
//         this.location = location;
//     }
// 
//     public Point getLocation() {
//         return this.location;
//     }
// 
//     public EntityType getEntityType() {
//         return this.entityType;
//     }
// 
// 
// }
// 
// Path: src/main/java/utilties/entities/Player.java
// public class Player extends Entity {
// 
//     private int id;
//     private int health;
//     private int damage;
//     private boolean isShielding;
//     private int shieldStrength;
// 
//     /**
//      * @param id       Player ID
//      * @param location Location of where Player will be added
//      */
//     public Player(int id, Point location) {
//         this.id = id;
//         this.health = 100;
//         this.damage = 10;
//         this.location = location;
//         entityType = EntityType.PLAYER;
//         this.isShielding = false;
//         this.shieldStrength = 5;
//     }
// 
//     /**
//      * Get the ID of the player
//      *
//      * @return ID of player
//      */
//     public int getId() {
//         return this.id;
//     }
// 
//     /**
//      * Get health of Player
//      *
//      * @return Health of Player
//      */
//     public int getHealth() {
//         return this.health;
//     }
// 
// 
//     /**
//      * Set health of player
//      *
//      * @param health Health to change to
//      */
//     public void setHealth(int health) {
//         this.health = health;
//     }
// 
// 
//     public int getDamage() {
//         return damage;
//     }
// 
//     public void setDamage(int damage) {
//         this.damage = damage;
//     }
// 
// 
//     public boolean isShielding() {
//         return isShielding;
//     }
// 
//     public void setShielding(boolean shielding) {
//         isShielding = shielding;
//     }
// 
//     public int getShieldStrength() {
//         return shieldStrength;
//     }
// 
//     public void setShieldStrength(int shieldStrength) {
//         this.shieldStrength = shieldStrength;
//     }
// 
// }


// Path: src/main/java/utilties/models/EntityMap.java
import org.mapeditor.core.Map;
import org.mapeditor.core.MapLayer;
import org.mapeditor.core.Tile;
import org.mapeditor.core.TileLayer;
import utilties.entities.Empty;
import utilties.entities.Entity;
import utilties.entities.Player;
import java.awt.*;
import java.util.ArrayList;

    private TileLayer getPlayerLayer() {
        ArrayList<MapLayer> layerList = new ArrayList<>(this._gameMap.getLayers());
        return (TileLayer) layerList.get(2);
    }


    /**
     * Moves location of EntityTile to new location.  This updates both Tiled's TileMap and well as our custom game map.
     * If the location to move to is occupied, the EntityTile stays in its current location, or if location is outside of player bounds
     *
     * @param entity           Entity to move
     * @param locationToMoveTo Location to move to
     * @return If EntityTile can move to that location
     */
    public boolean setLocation(EntityTile entity, Point locationToMoveTo) {

        //If outside of player bounds return false
        if (!isInsideMap(locationToMoveTo)) {
            return false;
        }

        //All movement is done on the player layer.  We need to grab a couple of references before we can move location.
        TileLayer playerLayer = getPlayerLayer();
        //Get the current location of the entity
        Point entityCurrentLocation = new Point(entity.getLocation());
        //Reference to the tile the player will be moving to
        EntityTile tileToMoveTo = _entityTiles[locationToMoveTo.x][locationToMoveTo.y];


        //If the tile to move to is empty, then it is a valid move
        if (tileToMoveTo.getEntityType() == Entity.EntityType.EMPTY) {