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-04
Revision:
0:5fa232ee5fdf
Child:
5:0b0651ac7832

File content as of revision 0:5fa232ee5fdf:

/*
 * 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"
#if 0
  #include "LevelData.h"
  #include "ExplosionManager.h"
#endif
  
  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 */
    /********************/
    void InitialiseLevel( void );

    /**********************************/
    /* 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.
    static void PlaySoundAndWait( const UInt8 *soundToPlay );

  };

#endif

/* END of LevelNormal.h */