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

Committer:
RichardE
Date:
Sun Jun 09 14:28:53 2013 +0000
Revision:
9:fa7e7b37b632
Parent:
5:0b0651ac7832
Child:
10:bfa1c307c99d
Sound is now working. Now a complete working game, albeit with only 2 levels.

Who changed what in which revision?

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