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
Level.h@18:70190f956a24, 2013-06-17 (annotated)
- Committer:
- RichardE
- Date:
- Mon Jun 17 15:10:43 2013 +0000
- Revision:
- 18:70190f956a24
- Parent:
- 10:bfa1c307c99d
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 : Level.h |
RichardE | 0:5fa232ee5fdf | 3 | * |
RichardE | 0:5fa232ee5fdf | 4 | * Definition of class Level. |
RichardE | 0:5fa232ee5fdf | 5 | * Base class for all levels. |
RichardE | 0:5fa232ee5fdf | 6 | * |
RichardE | 0:5fa232ee5fdf | 7 | */ |
RichardE | 0:5fa232ee5fdf | 8 | |
RichardE | 0:5fa232ee5fdf | 9 | #ifndef LevelDefined |
RichardE | 0:5fa232ee5fdf | 10 | |
RichardE | 0:5fa232ee5fdf | 11 | #define LevelDefined |
RichardE | 0:5fa232ee5fdf | 12 | |
RichardE | 0:5fa232ee5fdf | 13 | #include "Types.h" |
RichardE | 0:5fa232ee5fdf | 14 | #include "Gameduino.h" // Gameduino library |
RichardE | 1:dfd5eaaf96a3 | 15 | #include "GDExtra.h" // a few more Gameduino related functions |
RichardE | 1:dfd5eaaf96a3 | 16 | #include "GDConst.h" // a few more Gameduino constants |
RichardE | 1:dfd5eaaf96a3 | 17 | #include "CharCodes.h" // character codes |
RichardE | 1:dfd5eaaf96a3 | 18 | #include "CharBlocks.h" |
RichardE | 1:dfd5eaaf96a3 | 19 | #include "StringData.h" |
RichardE | 0:5fa232ee5fdf | 20 | #include "HighScoreTable.h" |
RichardE | 2:bb0f631a6068 | 21 | #include "CharFrame.h" |
RichardE | 4:673eb9735d44 | 22 | #include "PanelControls.h" |
RichardE | 4:673eb9735d44 | 23 | #include "PlayerObject.h" |
RichardE | 0:5fa232ee5fdf | 24 | #include "ArenaConst.h" |
RichardE | 0:5fa232ee5fdf | 25 | #include "SpriteImageId.h" |
RichardE | 0:5fa232ee5fdf | 26 | #include "GameObject.h" |
RichardE | 7:e72691603fd3 | 27 | #include "HumanObject.h" |
RichardE | 0:5fa232ee5fdf | 28 | #include "GruntObject.h" |
RichardE | 0:5fa232ee5fdf | 29 | #include "CrusherObject.h" |
RichardE | 1:dfd5eaaf96a3 | 30 | #include "BrainObject.h" |
RichardE | 8:82d88f9381f3 | 31 | #include "MutantObject.h" |
RichardE | 8:82d88f9381f3 | 32 | #include "BlueMeanyObject.h" |
RichardE | 0:5fa232ee5fdf | 33 | #include "SoundManager.h" |
RichardE | 0:5fa232ee5fdf | 34 | #include "Sounds.h" |
RichardE | 0:5fa232ee5fdf | 35 | |
RichardE | 0:5fa232ee5fdf | 36 | class Level { |
RichardE | 0:5fa232ee5fdf | 37 | |
RichardE | 0:5fa232ee5fdf | 38 | public : |
RichardE | 0:5fa232ee5fdf | 39 | |
RichardE | 0:5fa232ee5fdf | 40 | // Number of this level. |
RichardE | 0:5fa232ee5fdf | 41 | UInt8 LevelNumber; |
RichardE | 0:5fa232ee5fdf | 42 | |
RichardE | 10:bfa1c307c99d | 43 | // True if level was dynamically allocated. |
RichardE | 10:bfa1c307c99d | 44 | bool IsDynamicallyAllocated; |
RichardE | 10:bfa1c307c99d | 45 | |
RichardE | 0:5fa232ee5fdf | 46 | /***************/ |
RichardE | 0:5fa232ee5fdf | 47 | /* CONSTRUCTOR */ |
RichardE | 0:5fa232ee5fdf | 48 | /***************/ |
RichardE | 0:5fa232ee5fdf | 49 | Level(); |
RichardE | 0:5fa232ee5fdf | 50 | |
RichardE | 0:5fa232ee5fdf | 51 | /**************/ |
RichardE | 0:5fa232ee5fdf | 52 | /* DESTRUCTOR */ |
RichardE | 0:5fa232ee5fdf | 53 | /**************/ |
RichardE | 0:5fa232ee5fdf | 54 | virtual ~Level(); |
RichardE | 0:5fa232ee5fdf | 55 | |
RichardE | 0:5fa232ee5fdf | 56 | /************************/ |
RichardE | 0:5fa232ee5fdf | 57 | /* SET HIGH SCORE TABLE */ |
RichardE | 0:5fa232ee5fdf | 58 | /************************/ |
RichardE | 0:5fa232ee5fdf | 59 | // Pass pointer to EEPROM in e. |
RichardE | 0:5fa232ee5fdf | 60 | void SetHighScores( HighScoreTable *hst ) { |
RichardE | 0:5fa232ee5fdf | 61 | highScores = hst; |
RichardE | 0:5fa232ee5fdf | 62 | } |
RichardE | 1:dfd5eaaf96a3 | 63 | |
RichardE | 1:dfd5eaaf96a3 | 64 | /*************************************************/ |
RichardE | 1:dfd5eaaf96a3 | 65 | /* SET GAMEDUINO ON WHICH GRAPHICS WILL BE DRAWN */ |
RichardE | 1:dfd5eaaf96a3 | 66 | /*************************************************/ |
RichardE | 1:dfd5eaaf96a3 | 67 | // Pass pointer to a Gameduino. |
RichardE | 1:dfd5eaaf96a3 | 68 | void SetGameduino( Gameduino *g ) { |
RichardE | 1:dfd5eaaf96a3 | 69 | gd = g; |
RichardE | 1:dfd5eaaf96a3 | 70 | } |
RichardE | 1:dfd5eaaf96a3 | 71 | |
RichardE | 0:5fa232ee5fdf | 72 | /***************************************/ |
RichardE | 0:5fa232ee5fdf | 73 | /* SET PLAYER WHO IS PLAYING THE LEVEL */ |
RichardE | 0:5fa232ee5fdf | 74 | /***************************************/ |
RichardE | 0:5fa232ee5fdf | 75 | // Pass pointer to player in p. |
RichardE | 0:5fa232ee5fdf | 76 | void SetPlayer( PlayerObject *p ) { |
RichardE | 0:5fa232ee5fdf | 77 | player = p; |
RichardE | 0:5fa232ee5fdf | 78 | } |
RichardE | 0:5fa232ee5fdf | 79 | |
RichardE | 0:5fa232ee5fdf | 80 | // Enumeration of reasons why level ended. |
RichardE | 0:5fa232ee5fdf | 81 | enum LevelExitCode { |
RichardE | 0:5fa232ee5fdf | 82 | Completed, // level was completed |
RichardE | 0:5fa232ee5fdf | 83 | GameOver, // player has no more lives |
RichardE | 0:5fa232ee5fdf | 84 | }; |
RichardE | 0:5fa232ee5fdf | 85 | |
RichardE | 0:5fa232ee5fdf | 86 | /**************/ |
RichardE | 0:5fa232ee5fdf | 87 | /* PLAY LEVEL */ |
RichardE | 0:5fa232ee5fdf | 88 | /**************/ |
RichardE | 0:5fa232ee5fdf | 89 | // Returns code indicating how level ended. |
RichardE | 0:5fa232ee5fdf | 90 | virtual LevelExitCode Play( void ) = 0; |
RichardE | 0:5fa232ee5fdf | 91 | |
RichardE | 0:5fa232ee5fdf | 92 | protected : |
RichardE | 0:5fa232ee5fdf | 93 | |
RichardE | 1:dfd5eaaf96a3 | 94 | // Pointer to high score table. |
RichardE | 1:dfd5eaaf96a3 | 95 | HighScoreTable *highScores; |
RichardE | 0:5fa232ee5fdf | 96 | |
RichardE | 1:dfd5eaaf96a3 | 97 | // Gameduino on which level is played. |
RichardE | 1:dfd5eaaf96a3 | 98 | Gameduino *gd; |
RichardE | 1:dfd5eaaf96a3 | 99 | |
RichardE | 0:5fa232ee5fdf | 100 | // Player playing the level. |
RichardE | 4:673eb9735d44 | 101 | PlayerObject *player; |
RichardE | 0:5fa232ee5fdf | 102 | |
RichardE | 0:5fa232ee5fdf | 103 | /*************/ |
RichardE | 0:5fa232ee5fdf | 104 | /* PLAY LOOP */ |
RichardE | 0:5fa232ee5fdf | 105 | /*************/ |
RichardE | 0:5fa232ee5fdf | 106 | // Returns code indicating how level ended. |
RichardE | 0:5fa232ee5fdf | 107 | // This method should be called from the Play method after the |
RichardE | 0:5fa232ee5fdf | 108 | // level data has been initialised and the return value returned |
RichardE | 0:5fa232ee5fdf | 109 | // by the Play method. |
RichardE | 0:5fa232ee5fdf | 110 | virtual LevelExitCode PlayLoop( void ) = 0; |
RichardE | 0:5fa232ee5fdf | 111 | |
RichardE | 0:5fa232ee5fdf | 112 | }; |
RichardE | 0:5fa232ee5fdf | 113 | |
RichardE | 0:5fa232ee5fdf | 114 | #endif |
RichardE | 0:5fa232ee5fdf | 115 | |
RichardE | 0:5fa232ee5fdf | 116 | /* END of Level.h */ |
RichardE | 0:5fa232ee5fdf | 117 |