// 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 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.Rectangle;
import java.awt.image.BufferedImage;
import dev.codenmore.tilegame.Handler;
import dev.codenmore.tilegame.gfx.Assets;
package dev.codenmore.tilegame.items;



public class Item {
	
	// Handler
	
	public static Item[] items = new Item[256];
	public static Item woodItem = new Item(Assets.wood, "Wood", 0);
	public static Item rockItem = new Item(Assets.rock, "Rock", 1);
	
	// Class
	
	public static final int ITEMWIDTH = 32, ITEMHEIGHT = 32;
	
	protected Handler handler;
	protected BufferedImage texture;
	protected String name;
	protected final int id;
	
	protected Rectangle bounds;
	
	protected int x, y, count;
	protected boolean pickedUp = false;
	
	public Item(BufferedImage texture, String name, int id){
		this.texture = texture;
		this.name = name;
		this.id = id;
		count = 1;
		
		bounds = new Rectangle(x, y, ITEMWIDTH, ITEMHEIGHT);
		
		items[id] = this;
	}
	
	public void tick(){
		if(handler.getWorld().getEntityManager().getPlayer().getCollisionBounds(0f, 0f).intersects(bounds)){
			pickedUp = true;
			handler.getWorld().getEntityManager().getPlayer().getInventory().addItem(this);
		}
	}
	
	public void render(Graphics g){
		if(handler == null)
// 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 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 33/TileGame/src/dev/codenmore/tilegame/items/Item.java
import java.awt.Graphics;
import java.awt.Rectangle;
import java.awt.image.BufferedImage;
import dev.codenmore.tilegame.Handler;
import dev.codenmore.tilegame.gfx.Assets;

package dev.codenmore.tilegame.items;



public class Item {
	
	// Handler
	
	public static Item[] items = new Item[256];
	public static Item woodItem = new Item(Assets.wood, "Wood", 0);
	public static Item rockItem = new Item(Assets.rock, "Rock", 1);
	
	// Class
	
	public static final int ITEMWIDTH = 32, ITEMHEIGHT = 32;
	
	protected Handler handler;
	protected BufferedImage texture;
	protected String name;
	protected final int id;
	
	protected Rectangle bounds;
	
	protected int x, y, count;
	protected boolean pickedUp = false;
	
	public Item(BufferedImage texture, String name, int id){
		this.texture = texture;
		this.name = name;
		this.id = id;
		count = 1;
		
		bounds = new Rectangle(x, y, ITEMWIDTH, ITEMHEIGHT);
		
		items[id] = this;
	}
	
	public void tick(){
		if(handler.getWorld().getEntityManager().getPlayer().getCollisionBounds(0f, 0f).intersects(bounds)){
			pickedUp = true;
			handler.getWorld().getEntityManager().getPlayer().getInventory().addItem(this);
		}
	}
	
	public void render(Graphics g){
		if(handler == null)
			return;