// Path: Episode 34/TileGame/src/dev/codenmore/tilegame/Handler.java
// public class Handler {
// 	
// 	private Game game;
// 	private World world;
// 	
// 	public Handler(Game game){
// 		this.game = game;
// 	}
// 	
// 	public GameCamera getGameCamera(){
// 		return game.getGameCamera();
// 	}
// 	
// 	public KeyManager getKeyManager(){
// 		return game.getKeyManager();
// 	}
// 	
// 	public MouseManager getMouseManager(){
// 		return game.getMouseManager();
// 	}
// 	
// 	public int getWidth(){
// 		return game.getWidth();
// 	}
// 	
// 	public int getHeight(){
// 		return game.getHeight();
// 	}
// 
// 	public Game getGame() {
// 		return game;
// 	}
// 
// 	public void setGame(Game game) {
// 		this.game = game;
// 	}
// 
// 	public World getWorld() {
// 		return world;
// 	}
// 
// 	public void setWorld(World world) {
// 		this.world = world;
// 	}
// 
// }
// 
// Path: Episode 34/TileGame/src/dev/codenmore/tilegame/gfx/Animation.java
// public class Animation {
// 	
// 	private int speed, index;
// 	private long lastTime, timer;
// 	private BufferedImage[] frames;
// 	
// 	public Animation(int speed, BufferedImage[] frames){
// 		this.speed = speed;
// 		this.frames = frames;
// 		index = 0;
// 		timer = 0;
// 		lastTime = System.currentTimeMillis();
// 	}
// 	
// 	public void tick(){
// 		timer += System.currentTimeMillis() - lastTime;
// 		lastTime = System.currentTimeMillis();
// 		
// 		if(timer > speed){
// 			index++;
// 			timer = 0;
// 			if(index >= frames.length)
// 				index = 0;
// 		}
// 	}
// 	
// 	public BufferedImage getCurrentFrame(){
// 		return frames[index];
// 	}
// 
// }
// 
// Path: Episode 29/TileGame/src/dev/codenmore/tilegame/gfx/Assets.java
// public class Assets {
// 	
// 	private static final int width = 32, height = 32;
// 	
// 	public static BufferedImage dirt, grass, stone, tree, rock;
// 	public static BufferedImage[] player_down, player_up, player_left, player_right;
// 	public static BufferedImage[] zombie_down, zombie_up, zombie_left, zombie_right;
// 
// 	public static void init(){
// 		SpriteSheet sheet = new SpriteSheet(ImageLoader.loadImage("/textures/sheet.png"));
// 		
// 		player_down = new BufferedImage[2];
// 		player_up = new BufferedImage[2];
// 		player_left = new BufferedImage[2];
// 		player_right = new BufferedImage[2];
// 		
// 		player_down[0] = sheet.crop(width * 4, 0, width, height);
// 		player_down[1] = sheet.crop(width * 5, 0, width, height);
// 		player_up[0] = sheet.crop(width * 6, 0, width, height);
// 		player_up[1] = sheet.crop(width * 7, 0, width, height);
// 		player_right[0] = sheet.crop(width * 4, height, width, height);
// 		player_right[1] = sheet.crop(width * 5, height, width, height);
// 		player_left[0] = sheet.crop(width * 6, height, width, height);
// 		player_left[1] = sheet.crop(width * 7, height, width, height);
// 		
// 		zombie_down = new BufferedImage[2];
// 		zombie_up = new BufferedImage[2];
// 		zombie_left = new BufferedImage[2];
// 		zombie_right = new BufferedImage[2];
// 		
// 		zombie_down[0] = sheet.crop(width * 4, height * 2, width, height);
// 		zombie_down[1] = sheet.crop(width * 5, height * 2, width, height);
// 		zombie_up[0] = sheet.crop(width * 6, height * 2, width, height);
// 		zombie_up[1] = sheet.crop(width * 7, height * 2, width, height);
// 		zombie_right[0] = sheet.crop(width * 4, height * 3, width, height);
// 		zombie_right[1] = sheet.crop(width * 5, height * 3, width, height);
// 		zombie_left[0] = sheet.crop(width * 6, height * 3, width, height);
// 		zombie_left[1] = sheet.crop(width * 7, height * 3, width, height);
// 		
// 		dirt = sheet.crop(width, 0, width, height);
// 		grass = sheet.crop(width * 2, 0, width, height);
// 		stone = sheet.crop(width * 3, 0, width, height);
// 		tree = sheet.crop(0, 0, width, height * 2);
// 		rock = sheet.crop(0, height * 2, width, height);
// 	}
// 	
// }


import java.awt.Graphics;
import java.awt.image.BufferedImage;
import dev.codenmore.tilegame.Handler;
import dev.codenmore.tilegame.gfx.Animation;
import dev.codenmore.tilegame.gfx.Assets;
package dev.codenmore.tilegame.entities.creatures;



public class Player extends Creature {
	
	//Animations
	private Animation animDown, animUp, animLeft, animRight;
	
	public Player(Handler handler, float x, float y) {
		super(handler, x, y, Creature.DEFAULT_CREATURE_WIDTH, Creature.DEFAULT_CREATURE_HEIGHT);
		
		bounds.x = 22;
		bounds.y = 44;
		bounds.width = 19;
		bounds.height = 19;
		
		//Animatons
		animDown = new Animation(500, Assets.player_down);
		animUp = new Animation(500, Assets.player_up);
		animLeft = new Animation(500, Assets.player_left);
		animRight = new Animation(500, Assets.player_right);
	}

	@Override
	public void tick() {
		//Animations
		animDown.tick();
		animUp.tick();
		animRight.tick();
		animLeft.tick();
		//Movement
		getInput();
		move();
		handler.getGameCamera().centerOnEntity(this);
	}
	
	private void getInput(){
// Path: Episode 34/TileGame/src/dev/codenmore/tilegame/Handler.java
// public class Handler {
// 	
// 	private Game game;
// 	private World world;
// 	
// 	public Handler(Game game){
// 		this.game = game;
// 	}
// 	
// 	public GameCamera getGameCamera(){
// 		return game.getGameCamera();
// 	}
// 	
// 	public KeyManager getKeyManager(){
// 		return game.getKeyManager();
// 	}
// 	
// 	public MouseManager getMouseManager(){
// 		return game.getMouseManager();
// 	}
// 	
// 	public int getWidth(){
// 		return game.getWidth();
// 	}
// 	
// 	public int getHeight(){
// 		return game.getHeight();
// 	}
// 
// 	public Game getGame() {
// 		return game;
// 	}
// 
// 	public void setGame(Game game) {
// 		this.game = game;
// 	}
// 
// 	public World getWorld() {
// 		return world;
// 	}
// 
// 	public void setWorld(World world) {
// 		this.world = world;
// 	}
// 
// }
// 
// Path: Episode 34/TileGame/src/dev/codenmore/tilegame/gfx/Animation.java
// public class Animation {
// 	
// 	private int speed, index;
// 	private long lastTime, timer;
// 	private BufferedImage[] frames;
// 	
// 	public Animation(int speed, BufferedImage[] frames){
// 		this.speed = speed;
// 		this.frames = frames;
// 		index = 0;
// 		timer = 0;
// 		lastTime = System.currentTimeMillis();
// 	}
// 	
// 	public void tick(){
// 		timer += System.currentTimeMillis() - lastTime;
// 		lastTime = System.currentTimeMillis();
// 		
// 		if(timer > speed){
// 			index++;
// 			timer = 0;
// 			if(index >= frames.length)
// 				index = 0;
// 		}
// 	}
// 	
// 	public BufferedImage getCurrentFrame(){
// 		return frames[index];
// 	}
// 
// }
// 
// Path: Episode 29/TileGame/src/dev/codenmore/tilegame/gfx/Assets.java
// public class Assets {
// 	
// 	private static final int width = 32, height = 32;
// 	
// 	public static BufferedImage dirt, grass, stone, tree, rock;
// 	public static BufferedImage[] player_down, player_up, player_left, player_right;
// 	public static BufferedImage[] zombie_down, zombie_up, zombie_left, zombie_right;
// 
// 	public static void init(){
// 		SpriteSheet sheet = new SpriteSheet(ImageLoader.loadImage("/textures/sheet.png"));
// 		
// 		player_down = new BufferedImage[2];
// 		player_up = new BufferedImage[2];
// 		player_left = new BufferedImage[2];
// 		player_right = new BufferedImage[2];
// 		
// 		player_down[0] = sheet.crop(width * 4, 0, width, height);
// 		player_down[1] = sheet.crop(width * 5, 0, width, height);
// 		player_up[0] = sheet.crop(width * 6, 0, width, height);
// 		player_up[1] = sheet.crop(width * 7, 0, width, height);
// 		player_right[0] = sheet.crop(width * 4, height, width, height);
// 		player_right[1] = sheet.crop(width * 5, height, width, height);
// 		player_left[0] = sheet.crop(width * 6, height, width, height);
// 		player_left[1] = sheet.crop(width * 7, height, width, height);
// 		
// 		zombie_down = new BufferedImage[2];
// 		zombie_up = new BufferedImage[2];
// 		zombie_left = new BufferedImage[2];
// 		zombie_right = new BufferedImage[2];
// 		
// 		zombie_down[0] = sheet.crop(width * 4, height * 2, width, height);
// 		zombie_down[1] = sheet.crop(width * 5, height * 2, width, height);
// 		zombie_up[0] = sheet.crop(width * 6, height * 2, width, height);
// 		zombie_up[1] = sheet.crop(width * 7, height * 2, width, height);
// 		zombie_right[0] = sheet.crop(width * 4, height * 3, width, height);
// 		zombie_right[1] = sheet.crop(width * 5, height * 3, width, height);
// 		zombie_left[0] = sheet.crop(width * 6, height * 3, width, height);
// 		zombie_left[1] = sheet.crop(width * 7, height * 3, width, height);
// 		
// 		dirt = sheet.crop(width, 0, width, height);
// 		grass = sheet.crop(width * 2, 0, width, height);
// 		stone = sheet.crop(width * 3, 0, width, height);
// 		tree = sheet.crop(0, 0, width, height * 2);
// 		rock = sheet.crop(0, height * 2, width, height);
// 	}
// 	
// }


// Path: Episode 30/TileGame/src/dev/codenmore/tilegame/entities/creatures/Player.java
import java.awt.Graphics;
import java.awt.image.BufferedImage;
import dev.codenmore.tilegame.Handler;
import dev.codenmore.tilegame.gfx.Animation;
import dev.codenmore.tilegame.gfx.Assets;

package dev.codenmore.tilegame.entities.creatures;



public class Player extends Creature {
	
	//Animations
	private Animation animDown, animUp, animLeft, animRight;
	
	public Player(Handler handler, float x, float y) {
		super(handler, x, y, Creature.DEFAULT_CREATURE_WIDTH, Creature.DEFAULT_CREATURE_HEIGHT);
		
		bounds.x = 22;
		bounds.y = 44;
		bounds.width = 19;
		bounds.height = 19;
		
		//Animatons
		animDown = new Animation(500, Assets.player_down);
		animUp = new Animation(500, Assets.player_up);
		animLeft = new Animation(500, Assets.player_left);
		animRight = new Animation(500, Assets.player_right);
	}

	@Override
	public void tick() {
		//Animations
		animDown.tick();
		animUp.tick();
		animRight.tick();
		animLeft.tick();
		//Movement
		getInput();
		move();
		handler.getGameCamera().centerOnEntity(this);
	}
	
	private void getInput(){
		xMove = 0;