![](/media/cache/profiles/859bf1416b8b8761c5d588dee78dc65f.50x50_q85.jpg)
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
LevelNormal.h@18:70190f956a24, 2013-06-17 (annotated)
- Committer:
- RichardE
- Date:
- Mon Jun 17 15:10:43 2013 +0000
- Revision:
- 18:70190f956a24
- Parent:
- 12:81926431fea7
Improved response to button 1 when entering high scores (HighScoreEntry.cpp).
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
RichardE | 0:5fa232ee5fdf | 1 | /* |
RichardE | 0:5fa232ee5fdf | 2 | * SOURCE FILE : LevelNormal.h |
RichardE | 0:5fa232ee5fdf | 3 | * |
RichardE | 0:5fa232ee5fdf | 4 | * Definition of class LevelNormal. |
RichardE | 0:5fa232ee5fdf | 5 | * Base class for all "normal" levels. |
RichardE | 0:5fa232ee5fdf | 6 | * i.e. Levels that are not special attract modes |
RichardE | 0:5fa232ee5fdf | 7 | * but have enemies who are trying to kill you |
RichardE | 0:5fa232ee5fdf | 8 | * and so on. |
RichardE | 0:5fa232ee5fdf | 9 | * |
RichardE | 0:5fa232ee5fdf | 10 | */ |
RichardE | 0:5fa232ee5fdf | 11 | |
RichardE | 0:5fa232ee5fdf | 12 | #ifndef LevelNormalDefined |
RichardE | 0:5fa232ee5fdf | 13 | |
RichardE | 0:5fa232ee5fdf | 14 | #define LevelNormalDefined |
RichardE | 0:5fa232ee5fdf | 15 | |
RichardE | 0:5fa232ee5fdf | 16 | #include "Level.h" |
RichardE | 5:0b0651ac7832 | 17 | #include "LevelData.h" |
RichardE | 10:bfa1c307c99d | 18 | #include "LevelDescriptor.h" |
RichardE | 0:5fa232ee5fdf | 19 | #include "ExplosionManager.h" |
RichardE | 0:5fa232ee5fdf | 20 | |
RichardE | 0:5fa232ee5fdf | 21 | class LevelNormal : public Level { |
RichardE | 0:5fa232ee5fdf | 22 | |
RichardE | 0:5fa232ee5fdf | 23 | public : |
RichardE | 0:5fa232ee5fdf | 24 | |
RichardE | 0:5fa232ee5fdf | 25 | /***************/ |
RichardE | 0:5fa232ee5fdf | 26 | /* CONSTRUCTOR */ |
RichardE | 0:5fa232ee5fdf | 27 | /***************/ |
RichardE | 10:bfa1c307c99d | 28 | // Pass pointer to level descriptor data in data parameter. |
RichardE | 12:81926431fea7 | 29 | LevelNormal( const LevelDescriptor *data ); |
RichardE | 0:5fa232ee5fdf | 30 | |
RichardE | 0:5fa232ee5fdf | 31 | /**************/ |
RichardE | 0:5fa232ee5fdf | 32 | /* DESTRUCTOR */ |
RichardE | 0:5fa232ee5fdf | 33 | /**************/ |
RichardE | 0:5fa232ee5fdf | 34 | virtual ~LevelNormal(); |
RichardE | 0:5fa232ee5fdf | 35 | |
RichardE | 10:bfa1c307c99d | 36 | /**************/ |
RichardE | 10:bfa1c307c99d | 37 | /* PLAY LEVEL */ |
RichardE | 10:bfa1c307c99d | 38 | /**************/ |
RichardE | 10:bfa1c307c99d | 39 | // Returns code indicating how level ended. |
RichardE | 10:bfa1c307c99d | 40 | virtual LevelExitCode Play( void ); |
RichardE | 10:bfa1c307c99d | 41 | |
RichardE | 0:5fa232ee5fdf | 42 | protected : |
RichardE | 0:5fa232ee5fdf | 43 | |
RichardE | 0:5fa232ee5fdf | 44 | /*************/ |
RichardE | 0:5fa232ee5fdf | 45 | /* PLAY LOOP */ |
RichardE | 0:5fa232ee5fdf | 46 | /*************/ |
RichardE | 0:5fa232ee5fdf | 47 | // Returns code indicating how level ended. |
RichardE | 0:5fa232ee5fdf | 48 | // This method should be called from the Play method after the |
RichardE | 0:5fa232ee5fdf | 49 | // level data has been initialised and the return value returned |
RichardE | 0:5fa232ee5fdf | 50 | // by the Play method. |
RichardE | 0:5fa232ee5fdf | 51 | virtual LevelExitCode PlayLoop( void ); |
RichardE | 0:5fa232ee5fdf | 52 | |
RichardE | 0:5fa232ee5fdf | 53 | private : |
RichardE | 0:5fa232ee5fdf | 54 | |
RichardE | 10:bfa1c307c99d | 55 | // Data defining the level. |
RichardE | 10:bfa1c307c99d | 56 | LevelData dataForLevel; |
RichardE | 10:bfa1c307c99d | 57 | |
RichardE | 10:bfa1c307c99d | 58 | // Descriptor array of bytes. |
RichardE | 12:81926431fea7 | 59 | const LevelDescriptor *descriptorData; |
RichardE | 10:bfa1c307c99d | 60 | |
RichardE | 0:5fa232ee5fdf | 61 | // Current instance being processed. |
RichardE | 0:5fa232ee5fdf | 62 | static LevelNormal *currentInstance; |
RichardE | 0:5fa232ee5fdf | 63 | |
RichardE | 0:5fa232ee5fdf | 64 | /********************/ |
RichardE | 0:5fa232ee5fdf | 65 | /* INITIALISE LEVEL */ |
RichardE | 0:5fa232ee5fdf | 66 | /********************/ |
RichardE | 5:0b0651ac7832 | 67 | // Pass pointer to Gameduino to draw on in gd. |
RichardE | 5:0b0651ac7832 | 68 | void InitialiseLevel( Gameduino *gd ); |
RichardE | 0:5fa232ee5fdf | 69 | |
RichardE | 0:5fa232ee5fdf | 70 | /**********************************/ |
RichardE | 0:5fa232ee5fdf | 71 | /* DRAW SCORE AND NUMBER OF LIVES */ |
RichardE | 0:5fa232ee5fdf | 72 | /**********************************/ |
RichardE | 0:5fa232ee5fdf | 73 | void DrawScoreAndLives( void ); |
RichardE | 0:5fa232ee5fdf | 74 | |
RichardE | 0:5fa232ee5fdf | 75 | /******************/ |
RichardE | 0:5fa232ee5fdf | 76 | /* DRAW THE LEVEL */ |
RichardE | 0:5fa232ee5fdf | 77 | /******************/ |
RichardE | 0:5fa232ee5fdf | 78 | void DrawLevel( void ); |
RichardE | 0:5fa232ee5fdf | 79 | |
RichardE | 0:5fa232ee5fdf | 80 | /************************************************/ |
RichardE | 0:5fa232ee5fdf | 81 | /* HANDLE COLLISIONS BETWEEN HUMANS AND ENEMIES */ |
RichardE | 0:5fa232ee5fdf | 82 | /************************************************/ |
RichardE | 0:5fa232ee5fdf | 83 | // Pass index of human in level's humans array in humanIndex. |
RichardE | 0:5fa232ee5fdf | 84 | // Pass sprite number of sprite that it hit in spriteNumber. |
RichardE | 0:5fa232ee5fdf | 85 | static void HandleHumanCollision( UInt8 humanIndex, UInt8 spriteNumber ); |
RichardE | 0:5fa232ee5fdf | 86 | |
RichardE | 0:5fa232ee5fdf | 87 | /********************************************************/ |
RichardE | 0:5fa232ee5fdf | 88 | /* HANDLE COLLISIONS BETWEEN PLAYER BULLETS AND ENEMIES */ |
RichardE | 0:5fa232ee5fdf | 89 | /********************************************************/ |
RichardE | 0:5fa232ee5fdf | 90 | // Pass index of bullet in player's bullet array in bulletIndex. |
RichardE | 0:5fa232ee5fdf | 91 | // Pass sprite number of sprite that it hit in spriteNumber. |
RichardE | 0:5fa232ee5fdf | 92 | static void HandleBulletCollision( UInt8 bulletIndex, UInt8 spriteNumber ); |
RichardE | 0:5fa232ee5fdf | 93 | |
RichardE | 0:5fa232ee5fdf | 94 | /*********************************************************/ |
RichardE | 0:5fa232ee5fdf | 95 | /* CHECK FOR COLLISIONS BETWEEN PLAYER AND OTHER OBJECTS */ |
RichardE | 0:5fa232ee5fdf | 96 | /*********************************************************/ |
RichardE | 0:5fa232ee5fdf | 97 | // Pass pointer to a flag that will be set true if player is dead in isDead parameter. |
RichardE | 0:5fa232ee5fdf | 98 | void CheckPlayerCollisions( bool *isDead ); |
RichardE | 0:5fa232ee5fdf | 99 | |
RichardE | 0:5fa232ee5fdf | 100 | /***********************************************************************************/ |
RichardE | 0:5fa232ee5fdf | 101 | /* WAIT UNTIL SLOT FREE FOR A NEW SOUND, PLAY IT AND WAIT FOR ALL SOUNDS TO FINISH */ |
RichardE | 0:5fa232ee5fdf | 102 | /***********************************************************************************/ |
RichardE | 0:5fa232ee5fdf | 103 | // Pass sound to play in soundToPlay parameter. |
RichardE | 9:fa7e7b37b632 | 104 | void PlaySoundAndWait( const UInt8 *soundToPlay ); |
RichardE | 0:5fa232ee5fdf | 105 | |
RichardE | 0:5fa232ee5fdf | 106 | }; |
RichardE | 0:5fa232ee5fdf | 107 | |
RichardE | 0:5fa232ee5fdf | 108 | #endif |
RichardE | 0:5fa232ee5fdf | 109 | |
RichardE | 0:5fa232ee5fdf | 110 | /* END of LevelNormal.h */ |
RichardE | 0:5fa232ee5fdf | 111 |