/******************************************************************************
*******************************************************************************

	Bubble Fight EX
	relminator
	http://rel.betterwebber.com


	StarFighter class


*******************************************************************************
******************************************************************************/

#include <nds.h>
#include <gl2d.h>
#include "Vector2df32.h"
#include "cearn_atan.h"
#include "UTIL.h"
#include "Sound.h"
#include "Palettes.h"
#include "Explosion.h"

#ifndef StarFighter__H
#define StarFighter__H



class StarFighter
{
public:
		enum E_STATE
		{
			E_INVINCIBLE 	= (1 << 0),				// after death or stage start and end
			E_LOCKED 		= (1 << 1)				// stage start/end
		};

		enum E_MODE
		{
			E_ENTER     	= 0,				// stage start
			E_EXIT  		= 1 				// stage end
		};
		
		
		StarFighter();
		~StarFighter();
		
		bool Update( int KeyH, int KeyD );
		void Draw( int Palette, glImage* const Sprites ) const;
		void NewLife();
		void Kill();
		inline bool IsBursting() const
		{
			return ( BurstCounter > 0 );
		}
		
		inline bool	IsInvincible() const
		{
			return State & E_INVINCIBLE;
		}
		
		inline bool	IsLocked() const
		{
			return State & E_LOCKED;
		}
		s32		x;
		s32		y;
		int		Score;
		int 	Lives;
		int		State;		// Auto or manual
		int 	Mode;		// Enter Exit
		bool	IsAlive;
		int		NewLifeCounter;	// when to spawn another star
		int		StateCounter;	// invincible
		
	private:
		s32		Dx;
		s32		Dy;
		int		BurstCounter;
		int 	StartFrame;
		int 	FlipMode;
		int		Frame;
		int 	Counter;
		int 	Direction;
		bool	Active;
		
		void Bounce();
		void Limit();
		
};





#endif
