Version of Robotron arcade game using LPC1768, a Gameduino shield, a serial EEPROM (for high scores), two microswitch joysticks and two buttons plus a box to put it in. 20 levels of mayhem.

Dependencies:   25LCxxx_SPI CommonTypes Gameduino mbed

Revision:
9:fa7e7b37b632
Parent:
8:82d88f9381f3
Child:
10:bfa1c307c99d
--- a/LevelNormal.cpp	Sat Jun 08 17:51:33 2013 +0000
+++ b/LevelNormal.cpp	Sun Jun 09 14:28:53 2013 +0000
@@ -142,10 +142,8 @@
             if( enemy->SquashesHumans ) {
                 // Change human to dead state.
                 human->CurrentState = HumanObject::Dead;
-                #if 0
                 // Make a noise.
                 SoundManager::Instance.PlaySound( Sounds::HumanDies, 0, 0 );
-                #endif
             } else if( enemy->GetEnemyType() == Brain ) {
                 // Kill human by inserting a null into humans array.
                 humans[ humanIndex ] = (GameObject*)NULL;
@@ -199,10 +197,8 @@
         enemy->RegisterHitByBullet();
         // Kill off the bullet.
         currentInstance->player->KillBullet( currentInstance->gd, bulletIndex );
-        #if 0
         // Make a noise.
         SoundManager::Instance.PlaySound( Sounds::Explosion, 0, 0 );
-        #endif
         // Start explosion animation using coordinates of enemy.
         ExplosionManager::Instance.StartExplosion( enemy->Xco, enemy->Yco    );
     }
@@ -240,10 +236,8 @@
                 human->CurrentState = HumanObject::Rescued;
                 // Give player 50 points (in BCD!).
                 player->AddToScore( 0x50 );
-                #if 0
                 // Make a noise.
                 SoundManager::Instance.PlaySound( Sounds::RescueHuman, 0, 0 );
-                #endif
             }
         }
     }
@@ -255,23 +249,21 @@
 // Pass sound to play in soundToPlay parameter.
 void LevelNormal::PlaySoundAndWait( const UInt8 *soundToPlay )
 {
-#if 0
     // Keep trying to play sound until it works and meanwhile
     // keep currently playing sounds going.
     while( ! SoundManager::Instance.PlaySound( soundToPlay, 0, 0 ) ) {
         // Update sound manager.
         SoundManager::Instance.Update();
         // Wait for frame flyback.
-        GD.waitvblank();
+        gd->waitvblank();
     }
     // Now wait until all sounds have finished.
     while( SoundManager::Instance.CountSoundsPlaying() > 0 ) {
         // Update sound manager.
         SoundManager::Instance.Update();
         // Wait for frame flyback.
-        GD.waitvblank();
+        gd->waitvblank();
     }
-#endif
 }
 
 /*************/
@@ -302,7 +294,7 @@
         bool firstDraw = true;
         while( ! allEnemiesAreDead && ! gameIsOver ) {
             // Update sound manager.
-            // SoundManager::Instance.Update();
+            SoundManager::Instance.Update();
             // Wait for frame flyback.
             gd->waitvblank();
             // Check for collisions between player and other objects.
@@ -327,7 +319,7 @@
             FrameCounter++;
             // After first redraw play level start sound and wait for it to end.
             if( firstDraw ) {
-                // PlaySoundAndWait( Sounds::StartLevel );
+                PlaySoundAndWait( Sounds::StartLevel );
                 firstDraw = false;
             }
             // If player was killed then play death march and wait for it to finish.
@@ -336,7 +328,7 @@
                     pc.puts( "Player got killed.\r\n" );
                 #endif
                 // Player got killed.
-                // PlaySoundAndWait( Sounds::PlayerDead );
+                PlaySoundAndWait( Sounds::PlayerDead );
                 // One less life for player.
                 if( player->Lives > 0 ) {
                     player->Lives--;