void LoseLife(char *reason) { //Draw cracked screen - but draw all the rest of the world & hud first CloseGraphics(); OpenGraphics(); DrawWorld(&world, cameraPos, cameraAngle); DrawHUD(); DrawArrow(cameraAngle.y); DrawRadarDots(true); DrawRadarArm(sweepAngle * sweepStepCount++); DrawRadarDots(false); //finally! DrawCrackedScreen(); SetTextColor(RED); DrawText(25,40,reason); if (--lives<=0) { SetTextColor(GREEN); DrawText(30,55,"GAME OVER!"); } Show(); PlaySound(SOUND_EXPLOSION); //dead? if (lives<=0) { Sleep(2000); //Reset back to splash screen ResetTimer(); mode=0; Splash(); } else { // Hit but still going InitialiseWorld(); } }
//start the game void InitialiseGame() { srand(ReadTimer()); mode=1; score=0; InitialiseWorld(); refreshCount=0; resetCount=50; behaviourCount=0; ResetArrow(); arrowRefAngle=0; cameraPos=CreatePoint(0.0,5.0,0.0); cameraAngle=CreatePoint(0.0,0.0,0.0); blocked=0; lives=3; DrawHUD(); }
void Tutorial::Update() { // // If the world is not yet initialised, do that now if( !m_worldInitialised ) { InitialiseWorld(); } // // Is it time to run the next chapter? if( m_nextChapter != -1 && GetHighResTime() >= m_nextChapterTimer ) { // // Reset everything for the start of a new chapter m_currentChapter = m_nextChapter; m_nextChapter = -1; m_messageTimer = GetHighResTime(); SetObjectHighlight(); SetupCurrentChapter(); } // // Advance the current chapter if( m_currentChapter > -1 ) { UpdateCurrentChapter(); } }