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@0:5fa232ee5fdf, 2013-06-04 (annotated)
- Committer:
- RichardE
- Date:
- Tue Jun 04 20:16:33 2013 +0000
- Revision:
- 0:5fa232ee5fdf
- Child:
- 5:0b0651ac7832
Started conversion from Maple version of game. So far Gameduino seems to have been initialised OK and just displays a sign on message. Lots of commented out code.
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 | 0:5fa232ee5fdf | 17 | #if 0 |
RichardE | 0:5fa232ee5fdf | 18 | #include "LevelData.h" |
RichardE | 0:5fa232ee5fdf | 19 | #include "ExplosionManager.h" |
RichardE | 0:5fa232ee5fdf | 20 | #endif |
RichardE | 0:5fa232ee5fdf | 21 | |
RichardE | 0:5fa232ee5fdf | 22 | class LevelNormal : public Level { |
RichardE | 0:5fa232ee5fdf | 23 | |
RichardE | 0:5fa232ee5fdf | 24 | public : |
RichardE | 0:5fa232ee5fdf | 25 | |
RichardE | 0:5fa232ee5fdf | 26 | /***************/ |
RichardE | 0:5fa232ee5fdf | 27 | /* CONSTRUCTOR */ |
RichardE | 0:5fa232ee5fdf | 28 | /***************/ |
RichardE | 0:5fa232ee5fdf | 29 | LevelNormal(); |
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 | 0:5fa232ee5fdf | 36 | protected : |
RichardE | 0:5fa232ee5fdf | 37 | |
RichardE | 0:5fa232ee5fdf | 38 | // Data defining the level. |
RichardE | 0:5fa232ee5fdf | 39 | // You should write to this before calling PlayLoop. |
RichardE | 0:5fa232ee5fdf | 40 | // LevelData *DataForLevel; |
RichardE | 0:5fa232ee5fdf | 41 | |
RichardE | 0:5fa232ee5fdf | 42 | /*************/ |
RichardE | 0:5fa232ee5fdf | 43 | /* PLAY LOOP */ |
RichardE | 0:5fa232ee5fdf | 44 | /*************/ |
RichardE | 0:5fa232ee5fdf | 45 | // Returns code indicating how level ended. |
RichardE | 0:5fa232ee5fdf | 46 | // This method should be called from the Play method after the |
RichardE | 0:5fa232ee5fdf | 47 | // level data has been initialised and the return value returned |
RichardE | 0:5fa232ee5fdf | 48 | // by the Play method. |
RichardE | 0:5fa232ee5fdf | 49 | virtual LevelExitCode PlayLoop( void ); |
RichardE | 0:5fa232ee5fdf | 50 | |
RichardE | 0:5fa232ee5fdf | 51 | private : |
RichardE | 0:5fa232ee5fdf | 52 | |
RichardE | 0:5fa232ee5fdf | 53 | // Current instance being processed. |
RichardE | 0:5fa232ee5fdf | 54 | static LevelNormal *currentInstance; |
RichardE | 0:5fa232ee5fdf | 55 | |
RichardE | 0:5fa232ee5fdf | 56 | /********************/ |
RichardE | 0:5fa232ee5fdf | 57 | /* INITIALISE LEVEL */ |
RichardE | 0:5fa232ee5fdf | 58 | /********************/ |
RichardE | 0:5fa232ee5fdf | 59 | void InitialiseLevel( void ); |
RichardE | 0:5fa232ee5fdf | 60 | |
RichardE | 0:5fa232ee5fdf | 61 | /**********************************/ |
RichardE | 0:5fa232ee5fdf | 62 | /* DRAW SCORE AND NUMBER OF LIVES */ |
RichardE | 0:5fa232ee5fdf | 63 | /**********************************/ |
RichardE | 0:5fa232ee5fdf | 64 | void DrawScoreAndLives( void ); |
RichardE | 0:5fa232ee5fdf | 65 | |
RichardE | 0:5fa232ee5fdf | 66 | /******************/ |
RichardE | 0:5fa232ee5fdf | 67 | /* DRAW THE LEVEL */ |
RichardE | 0:5fa232ee5fdf | 68 | /******************/ |
RichardE | 0:5fa232ee5fdf | 69 | void DrawLevel( void ); |
RichardE | 0:5fa232ee5fdf | 70 | |
RichardE | 0:5fa232ee5fdf | 71 | /************************************************/ |
RichardE | 0:5fa232ee5fdf | 72 | /* HANDLE COLLISIONS BETWEEN HUMANS AND ENEMIES */ |
RichardE | 0:5fa232ee5fdf | 73 | /************************************************/ |
RichardE | 0:5fa232ee5fdf | 74 | // Pass index of human in level's humans array in humanIndex. |
RichardE | 0:5fa232ee5fdf | 75 | // Pass sprite number of sprite that it hit in spriteNumber. |
RichardE | 0:5fa232ee5fdf | 76 | static void HandleHumanCollision( UInt8 humanIndex, UInt8 spriteNumber ); |
RichardE | 0:5fa232ee5fdf | 77 | |
RichardE | 0:5fa232ee5fdf | 78 | /********************************************************/ |
RichardE | 0:5fa232ee5fdf | 79 | /* HANDLE COLLISIONS BETWEEN PLAYER BULLETS AND ENEMIES */ |
RichardE | 0:5fa232ee5fdf | 80 | /********************************************************/ |
RichardE | 0:5fa232ee5fdf | 81 | // Pass index of bullet in player's bullet array in bulletIndex. |
RichardE | 0:5fa232ee5fdf | 82 | // Pass sprite number of sprite that it hit in spriteNumber. |
RichardE | 0:5fa232ee5fdf | 83 | static void HandleBulletCollision( UInt8 bulletIndex, UInt8 spriteNumber ); |
RichardE | 0:5fa232ee5fdf | 84 | |
RichardE | 0:5fa232ee5fdf | 85 | /*********************************************************/ |
RichardE | 0:5fa232ee5fdf | 86 | /* CHECK FOR COLLISIONS BETWEEN PLAYER AND OTHER OBJECTS */ |
RichardE | 0:5fa232ee5fdf | 87 | /*********************************************************/ |
RichardE | 0:5fa232ee5fdf | 88 | // Pass pointer to a flag that will be set true if player is dead in isDead parameter. |
RichardE | 0:5fa232ee5fdf | 89 | void CheckPlayerCollisions( bool *isDead ); |
RichardE | 0:5fa232ee5fdf | 90 | |
RichardE | 0:5fa232ee5fdf | 91 | /***********************************************************************************/ |
RichardE | 0:5fa232ee5fdf | 92 | /* WAIT UNTIL SLOT FREE FOR A NEW SOUND, PLAY IT AND WAIT FOR ALL SOUNDS TO FINISH */ |
RichardE | 0:5fa232ee5fdf | 93 | /***********************************************************************************/ |
RichardE | 0:5fa232ee5fdf | 94 | // Pass sound to play in soundToPlay parameter. |
RichardE | 0:5fa232ee5fdf | 95 | static void PlaySoundAndWait( const UInt8 *soundToPlay ); |
RichardE | 0:5fa232ee5fdf | 96 | |
RichardE | 0:5fa232ee5fdf | 97 | }; |
RichardE | 0:5fa232ee5fdf | 98 | |
RichardE | 0:5fa232ee5fdf | 99 | #endif |
RichardE | 0:5fa232ee5fdf | 100 | |
RichardE | 0:5fa232ee5fdf | 101 | /* END of LevelNormal.h */ |
RichardE | 0:5fa232ee5fdf | 102 |