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: Level.h
- Revision:
- 0:5fa232ee5fdf
- Child:
- 1:dfd5eaaf96a3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Level.h Tue Jun 04 20:16:33 2013 +0000 @@ -0,0 +1,102 @@ +/* + * SOURCE FILE : Level.h + * + * Definition of class Level. + * Base class for all levels. + * + */ + +#ifndef LevelDefined + + #define LevelDefined + + #include "Types.h" + #include "Gameduino.h" // Gameduino library + #include "HighScoreTable.h" +#if 0 + #include "GDConst.h" // a few more Gameduino constants + #include "GDExtra.h" // a few more Gameduino related functions + #include "ArenaConst.h" + #include "SpriteImageId.h" + #include "CharCodes.h" // character codes + #include "GameObject.h" + #include "GruntObject.h" + #include "BlueMeanyObject.h" + #include "CrusherObject.h" + #include "BrainObject.h" + #include "StringData.h" + #include "CharFrame.h" + #include "SoundManager.h" + #include "Sounds.h" +#endif + + class Level { + + public : + + // Number of this level. + UInt8 LevelNumber; + + /***************/ + /* CONSTRUCTOR */ + /***************/ + Level(); + + /**************/ + /* DESTRUCTOR */ + /**************/ + virtual ~Level(); + + /************************/ + /* SET HIGH SCORE TABLE */ + /************************/ + // Pass pointer to EEPROM in e. + void SetHighScores( HighScoreTable *hst ) { + highScores = hst; + } + + /***************************************/ + /* SET PLAYER WHO IS PLAYING THE LEVEL */ + /***************************************/ + // Pass pointer to player in p. +#if 0 + void SetPlayer( PlayerObject *p ) { + player = p; + } +#endif + + // Enumeration of reasons why level ended. + enum LevelExitCode { + Completed, // level was completed + GameOver, // player has no more lives + }; + + /**************/ + /* PLAY LEVEL */ + /**************/ + // Returns code indicating how level ended. + virtual LevelExitCode Play( void ) = 0; + + protected : + + // Pointer to high score table. + HighScoreTable *highScores; + + // Player playing the level. + // PlayerObject *player; + + /*************/ + /* PLAY LOOP */ + /*************/ + // Returns code indicating how level ended. + // This method should be called from the Play method after the + // level data has been initialised and the return value returned + // by the Play method. + virtual LevelExitCode PlayLoop( void ) = 0; + + }; + +#endif + +/* END of Level.h */ +