#ifndef CHARACTER_H
#define CHARACTER_H

using namespace Salamander;

namespace Salamander
{
	class ButtonEvent;
	class World;
}

class Character : public Body
{
	public:
		enum AnimationFrame
		{
			STAND = 0,
			RUN1 = 1,
			RUN2 = 2,
			RUN3 = 3,
			JUMP = 3,
			FALL1 = 4,
			FALL2 = 5,
			LAND = 6,
		};

    public:
        Character();
        virtual ~Character();

        void frame();

	protected:
		virtual void updateMatrix();
		virtual void propogate();

	private:
		void onButtonEvent(const ButtonEvent& event);
		void generate();

		void jump();
		void movement();
		void animate();
		void updateTouchingLand();

    private:
		Sprite* sprite_;

		std::vector<Texture*> textures_;

		bool lkey_;
		bool rkey_;
		Vec2 bodysize_;
		bool touchingland_;
		double maxspeed_;
		double autopercent_;
		double animationframe_;
		int currentframe_;
		double runvelocity_;
		bool autoaccelerate_;
};


#endif // CHARACTER_H
