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

Committer:
RichardE
Date:
2013-06-09
Revision:
9:fa7e7b37b632
Parent:
5:0b0651ac7832
Child:
10:bfa1c307c99d

File content as of revision 9:fa7e7b37b632:

/*
 * SOURCE FILE : LevelNormal.h
 *
 * Definition of class LevelNormal.
 * Base class for all "normal" levels.
 * i.e. Levels that are not special attract modes
 * but have enemies who are trying to kill you
 * and so on.
 *
 */

#ifndef LevelNormalDefined

  #define LevelNormalDefined

  #include "Level.h"
  #include "LevelData.h"
  #include "ExplosionManager.h"
  
  class LevelNormal : public Level {

  public :

    /***************/
    /* CONSTRUCTOR */
    /***************/
    LevelNormal();

    /**************/
    /* DESTRUCTOR */
    /**************/
    virtual ~LevelNormal();

  protected :

    // Data defining the level.
    // You should write to this before calling PlayLoop.
    LevelData *DataForLevel;
    
    /*************/
    /* 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 );
    
  private :

    // Current instance being processed.
    static LevelNormal *currentInstance;

    /********************/
    /* INITIALISE LEVEL */
    /********************/
    // Pass pointer to Gameduino to draw on in gd.
    void InitialiseLevel( Gameduino *gd );

    /**********************************/
    /* DRAW SCORE AND NUMBER OF LIVES */
    /**********************************/
    void DrawScoreAndLives( void );

    /******************/
    /* DRAW THE LEVEL */
    /******************/
    void DrawLevel( void );

    /************************************************/
    /* HANDLE COLLISIONS BETWEEN HUMANS AND ENEMIES */
    /************************************************/
    // Pass index of human in level's humans array in humanIndex.
    // Pass sprite number of sprite that it hit in spriteNumber.
    static void HandleHumanCollision( UInt8 humanIndex, UInt8 spriteNumber );

    /********************************************************/
    /* HANDLE COLLISIONS BETWEEN PLAYER BULLETS AND ENEMIES */
    /********************************************************/
    // Pass index of bullet in player's bullet array in bulletIndex.
    // Pass sprite number of sprite that it hit in spriteNumber.
    static void HandleBulletCollision( UInt8 bulletIndex, UInt8 spriteNumber );

    /*********************************************************/
    /* CHECK FOR COLLISIONS BETWEEN PLAYER AND OTHER OBJECTS */
    /*********************************************************/
    // Pass pointer to a flag that will be set true if player is dead in isDead parameter.
    void CheckPlayerCollisions( bool *isDead );

    /***********************************************************************************/
    /* WAIT UNTIL SLOT FREE FOR A NEW SOUND, PLAY IT AND WAIT FOR ALL SOUNDS TO FINISH */
    /***********************************************************************************/
    // Pass sound to play in soundToPlay parameter.
    void PlaySoundAndWait( const UInt8 *soundToPlay );

  };

#endif

/* END of LevelNormal.h */