package holo.bolt.entity;

import holo.bolt.BoltMain;
import holo.bolt.render.RenderEntity;
import holo.bolt.render.RenderPlayer;
import holo.bolt.world.World;
import holo.bolt.world.map.tile.Tile;

public class EntityPlayer extends Entity
{
	RenderEntity render;
	public boolean hasBolt;
	
	public EntityPlayer(float[] position, World world)
	{
		super(position, new float[] {18, 18}, world);
		render = new RenderPlayer(this);
		hasBolt = true;
	}

	@Override
	public String getTextureLoc()
	{
		return "res/Player.png";
	}
	
	public String getTextureLoc2()
	{
		return "res/Player2.png";
	}

	@Override
	public RenderEntity getRender()
	{
		return render;
	}

	@Override
	public void onCollideWithEntity(Entity entity)
	{
		if(entity instanceof EntityBolt)
		{
			entity.setDead();
			this.hasBolt = true;
		}
	}
	
	public void setDead()
	{
		this.world.state.game.enterState(BoltMain.GAME_OVER_ID);
	}
	
	public void attack()
	{
		
	}
	
	public void shoot()
	{
		if(hasBolt)
		{
			world.registerEntity(new EntityBolt(new float[] {this.pos[0] + this.facing.x * this.box.size[0] * 1.5F, this.pos[1] + this.facing.y * this.box.size[1] * 1.5F}, world, this.facing.copy()));
			hasBolt = false;
		}
	}

	@Override
	public float maxHealth()
	{
		return 15;
	}

	@Override
	public void onCollideWithTile(Tile t){}
}
