#pragma once

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


static const float LAND_TIME = 7; // seconds


class GameFrame;

class GamePlanet : public Sprite {
public:
	GamePlanet(spInputBase input, GameFrame* game, int planetN);

	bool step(float t, float at);
	void setAngle(float a, float factor=1.0f);
	int getBackgroundScroll();
	float getTimeLeft() const { return timeLeft; }
	float getOffset() const { return offset; }
	float getRadius() const { return radius; }
	void die();
	String getName();

	bool isSafe();
	bool isSafe(float angle);
	float getAngle() const { return angle; }
	//void render(Renderer& renderer) const;

	spGamePlanetObject createObject(float angle, ObjectType type, int layer=-9999);
	void addObject(spGamePlanetObject obj);
	spGamePlayer player;

private:
	float stageTime;

	int planetN;

	float timeLeft;
	float radius;
	float offset;
	float rumble;

	spGamePlanetObject rocket;
	GameFrame* game;
	spInputBase input;

	std::list<spGamePlanetObject> objects;
};
