Game Development Reference
In-Depth Information
// Cannot continue further since game is now over
m_CanContinue = false;
SaveContinueStatus(MainActivity.SAVE_GAME_HANDLE);
return;
}
The UpdateScene() function has to be modified to process the game over state. (See Listing 10-41.)
If the game state is the game over screen state, the UpdateScene() function updates the position
of the game over billboard to make sure it is in front of and facing the camera. If the health of the
player's power pyramid is less than or equal to 0, the UpdateScene() function sets the game state
to the game over screen state and sets the can continue status to false to indicate that this game is
over and cannot be continued later.
Listing 10-41. Modifying the UpdateScene() Function
if (m_GameState == GameState.GameOverScreen)
{
// Update Game Over Screen Here
UpdateGameOverBillBoard();
m_GameOverBillBoard.UpdateObject3d(m_Camera);
return;
}
if (m_Pyramid.GetObjectStats().GetHealth() <= 0)
{
m_GameState = GameState.GameOverScreen;
m_GameOverStartTime = System.currentTimeMillis();
// Game is over cannnot continue current game.
m_CanContinue = false;
}
The RenderScene() function must be modified so that when the game state is in the game over
screen state, the game over billboard is rendered to the screen. (See Listing 10-42.)
Listing 10-42. Modifying the RenderScene() Function
if (m_GameState == GameState.GameOverScreen)
{
// Update Game Over Screen Here
m_GameOverBillBoard.DrawObject(m_Camera, m_PointLight);
}
Hands-on Example: The Drone Grid Game
This hands-on example will demonstrate the final Drone Grid game with a fully working menu
system and using the classes discussed previously in this chapter for creating and managing groups
of arena objects and tanks. In addition, I cover code that controls the frame rate of the game,
so that it runs at a smooth constant frame rate. All these additions and changes are made in the
MyGLRenderer class.
 
Search WWH ::




Custom Search