Constructor CStatePlay::CStatePlay() Using CGameState(EGS_Play)
	m_iScoreTxtID = agk::CreateText("SCORE: 0")
	agk::SetTextPosition(m_iScoreTxtID, 0, 0)
	agk::SetTextSize(m_iScoreTxtID, 20)
	agk::SetTextColorAlpha(m_iScoreTxtID, 0)
	agk::SetTextVisible(m_iScoreTxtID, 0)
	agk::FixTextToScreen(m_iScoreTxtID, 1)
	
	m_iLivesTxtID = agk::CreateText("LIVES: 3")
	agk::SetTextPosition(m_iLivesTxtID, 300, 0)
	agk::SetTextSize(m_iLivesTxtID, 20)
	agk::SetTextColorAlpha(m_iLivesTxtID, 0)
	agk::SetTextVisible(m_iLivesTxtID, 0)
	agk::FixTextToScreen(m_iLivesTxtID, 1)
End Constructor

Destructor CStatePlay::~CStatePlay()

End Destructor

Function CStatePlay::Run(fFrameTime As float) As EGameState
	If Not agk::GetTextVisible(m_iScoreTxtID) Then
		agk::SetTextVisible(m_iScoreTxtID, 1)
		agk::SetTextVisible(m_iLivesTxtID, 1)
	EndIf
	
	Raw As UINT alpha = agk::GetTextColorAlpha(m_iScoreTxtID)
	
	If alpha < 255 Then
		agk::SetTextColorAlpha(m_iScoreTxtID, alpha + 2)
		agk::SetTextColorAlpha(m_iScoreTxtID, alpha + 2)
	EndIf
	
	m_refPlayer->UpdatePlayer()
	m_refAliens->UpdateAliens()
	
	this->UpdateText()
	
	If m_refPlayer->IsGameOver() Then Function = EGS_End
	
	Function = m_eState
End Function

Sub CStatePlay::Reset()
	m_refPlayer->ResetPlayer(1)
	m_refPlayer->ResetBullets()
	m_refAliens->ResetAliens()
End Sub

Sub CStatePlay::UpdateText()
	Static last_score As integer
	Static last_lives As integer
	last_score = -1
	last_lives = -1
	
	Raw As integer score = m_refPlayer->GetScore()
	Raw As integer lives = m_refPlayer->GetLives()
	
	If score <> last_score Then
		Raw As std::string line("SCORE: ")
		line += agk::Str(score)
		agk::SetTextString(m_iScoreTxtID, line.c_str())
		last_score = score
	EndIf
	
	If lives <> last_lives Then
		Raw As std::string line("LIVES: ")
		line += agk::Str(lives)
		agk::SetTextString(m_iLivesTxtID, line.c_str())
		last_lives = lives
	EndIf
End Sub
