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
Diff: LevelNormal.cpp
- Revision:
- 13:50779b12ff51
- Parent:
- 12:81926431fea7
--- a/LevelNormal.cpp Mon Jun 10 20:02:28 2013 +0000 +++ b/LevelNormal.cpp Tue Jun 11 19:29:04 2013 +0000 @@ -49,6 +49,8 @@ /* INITIALISE LEVEL */ /********************/ // Pass pointer to Gameduino to draw on in gd. +// Note that this is called at the start of every level but also when the player +// is killed and the level restarts with the remaining enemies. void LevelNormal::InitialiseLevel( Gameduino *gd ) { // Note that if you re-arrange the following code you may need to adjust the @@ -66,6 +68,9 @@ for( UInt8 e = 0; e < LevelData::MaxEnemies; ++e ) { object = (EnemyObject*)dataForLevel.Enemies[ e ]; if( object != (EnemyObject*)NULL ) { + // Perform any further initialisation required + // at level start or restart. + object->LevelRestart(); // Get enemy to chase the player. object->SetChaseObject( player ); // Pass array of all enemies to this enemy. @@ -384,9 +389,6 @@ } // If player was killed then play death march and wait for it to finish. if( playerIsDead ) { - #ifdef CHATTY - pc.puts( "Player got killed.\r\n" ); - #endif // Player got killed. PlaySoundAndWait( Sounds::PlayerDead ); // One less life for player. @@ -397,9 +399,6 @@ gameIsOver = ( player->Lives == 0 ); // If game is not over then re-initialise level using any remaining enemies. if( ! gameIsOver ) { - #ifdef CHATTY - pc.puts( "Game is over.\r\n" ); - #endif // Remove all objects that do not survive a level restart (like enemy bullets). GameObject::RemoveUnretainedObjects( dataForLevel.Enemies, LevelData::MaxEnemies ); InitialiseLevel( gd );