Game Development Reference
In-Depth Information
The UpdateGameOverBillBoard() function calculates and positions the game over billboard in front of
the camera at a DistanceToBillBoard distance to the camera. (See Listing 10-37.)
Listing 10-37. Updating the Game Over BillBoard
void UpdateGameOverBillBoard()
{
Vector3 TempVec = new Vector3(0,0,0);
float DistanceToBillBoard = 5;
TempVec.Set(m_Camera.GetOrientation().GetForwardWorldCoords().x, m_Camera.GetOrientation().
GetForwardWorldCoords().y, m_Camera.GetOrientation().GetForwardWorldCoords().z);
TempVec.Multiply(DistanceToBillBoard);
Vector3 Position = Vector3.Add(m_Camera.GetOrientation().GetPosition(), TempVec);
m_GameOverBillBoard.m_Orientation.SetPosition(Position);
}
The IsNewHighScore() function returns true, which means there will be a new entry in the high score
table if the player's score is greater than the lowest score in the high score table or if the player's
score is greater than zero and there is at least one blank slot in the top ten scores in the high score
table. The latter case handles the situation where the player's score is equal to or less than the
lowest score currently in the table but there are blank entries left in the top ten scores in the high
score table. (See Listing 10-38.)
Listing 10-38. Testing If the Player Has a New High Score
boolean IsNewHighScore()
{
boolean result = false;
int LowestScore = m_HighScoreTable.GetLowestScore();
int MaxScores = m_HighScoreTable.MaxNumberHighScores();
int NumberValidScores = m_HighScoreTable.NumberValidHighScores();
boolean SlotAvailable = false;
if (NumberValidScores < MaxScores)
{
SlotAvailable = true;
}
if ((m_Score > LowestScore) ||
((m_Score > 0) && SlotAvailable))
{
result = true;
}
return result;
}
The SaveContinueStatus() function saves the m_CanContinue variable that is true if there is a
previously saved game that can be loaded and then continued. (See Listing 10-39.)
 
Search WWH ::




Custom Search