#ifndef PERSON_H
#define PERSON_H


#include "Object.h"
#include "Sprite.h"
#include "ShowOneSprite.h"

class Weapon;
class WeaponPunch;

typedef enum { JUMPING, STANDING, RUNNING, FALLING, WALLFALLING, CROUCHING, PUNCHING, DEAD } State;

class Person : public Object
{
public:

	//Person();
	Person(List* personInfo, int x, int y);
	~Person();
	void draw();
	void collide( Object* o );
	virtual void update();
	void jump(xDirection xDir);
	void jumpReset();
	void crouch();
	void uncrouch();
	void shoot();
	virtual void setPos(int x, int y);

	virtual Object *copy();

	void load(List *personInfo, bool fromConstructor = true);

	void setVelocity(int x, int y) {_xVelocity = x; _yVelocity = y;}

	int getHealth() {return _health;}
	virtual void addHealth(int dHealth);

	//static Person * load(List* personInfo, int x, int y);

	//void move(int x, int y);
	void incrVelocity(int xVel, int yVel);


	void setXDirection(xDirection xDir){_prevXDirection = _xDirection; _xDirection = xDir;};
	int getAccel();

	xDirection getXDirection() { return _xDirection; }
	yDirection getYDirection() { return _yDirection; }


	void aim( yDirection direction){_yDirection = direction;};

	bool touchingAbove(int pels = 1);
	bool touchingBelow(int pels = 1);
	bool touchingLeft(int pels = 1);
	bool touchingRight(int pels = 1);

	virtual bool invincible() { return _invincible;}
	virtual void setInvincible(bool inv) {_invincible = inv;}

	virtual void die();
	virtual void live();
protected:


	bool _invincible;

	int _xVelocity;
	int _yVelocity;
	int _maxXVel;
	int _maxYVel;
	int _maxFallRate;

	int _previousX;
	int _previousY;

	xDirection _xDirection;
	xDirection _prevXDirection;
	yDirection _yDirection;
	State _state;

	std::string _dropItem;

	bool _crouching;
	/*
	True if the person is jumping
	*/
	//bool _jumping;

	//int _wallJump;

	/* true if the person is wallJumping
	*/
	//bool _wallJumping;

	int _health;
                   
	int _gravity;
	int _accel;
	int _airAccel;
	double _groundDrag;
	double _airDrag;

	int _jumpTimer;
	int _maxJumpTime;
	bool _jumpReset;
	bool _wallJumpReset;

	int _wallFallTime;


	Weapon *_primaryWeapon;
	WeaponPunch *_punchWeapon;
	int _punchTimer;

	ShowOneSprite *_sprite;

};

#endif