#pragma once

#include "sprite.h"
#include "game_planet_object.h"

class GamePlanet;
class GamePlanetObject;
typedef shared_ptr<GamePlanetObject> spGamePlanetObject;

class GamePlayer : public Sprite {
public:
	GamePlayer(spInputBase input, Vector2f pos, GamePlanet* planet);

	bool step(float t, float at);
	void stepJump(float t, float at);
	void stepMovement(float t, float at);
	void die();
	void endTime();

	void collect(GamePlanetObject& object);
	void onTouchRocket();
	void setAutoPilot();

	bool isInRocket() const { return rocket > 0; }
	bool isDead() const { return !active || dying == 1; }

	virtual void render(Renderer& renderer) const;

	std::vector<ObjectType> inventory;

private:

	spInputBase input;

	int facing;
	int dashing;
	int jumping;
	int jumpRequest;
	int dying;
	int spawning;
	int rocket;
	int jumpRecovery;
	int invulnerable;
	int stepN;
	int lastFrame;
	bool active;
	bool gotEndTime;
	bool neutralY;
	bool autoPilot;

	float posX;
	float aSpeed;

	Vector2f vel;
	Vector2f basePos;

	GamePlanet* planet;
};

typedef shared_ptr<GamePlayer> spGamePlayer;