![](/media/cache/profiles/859bf1416b8b8761c5d588dee78dc65f.50x50_q85.jpg)
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@5:0b0651ac7832, 2013-06-08 (annotated)
- Committer:
- RichardE
- Date:
- Sat Jun 08 14:40:47 2013 +0000
- Revision:
- 5:0b0651ac7832
- Parent:
- 0:5fa232ee5fdf
- Child:
- 9:fa7e7b37b632
Now got first real level starting and player can be controlled using joysticks. No bullets, enemies, humans or sound yet.
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 | 5:0b0651ac7832 | 17 | #include "LevelData.h" |
RichardE | 0:5fa232ee5fdf | 18 | #if 0 |
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 | 5:0b0651ac7832 | 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 | 5:0b0651ac7832 | 59 | // Pass pointer to Gameduino to draw on in gd. |
RichardE | 5:0b0651ac7832 | 60 | void InitialiseLevel( Gameduino *gd ); |
RichardE | 0:5fa232ee5fdf | 61 | |
RichardE | 0:5fa232ee5fdf | 62 | /**********************************/ |
RichardE | 0:5fa232ee5fdf | 63 | /* DRAW SCORE AND NUMBER OF LIVES */ |
RichardE | 0:5fa232ee5fdf | 64 | /**********************************/ |
RichardE | 0:5fa232ee5fdf | 65 | void DrawScoreAndLives( void ); |
RichardE | 0:5fa232ee5fdf | 66 | |
RichardE | 0:5fa232ee5fdf | 67 | /******************/ |
RichardE | 0:5fa232ee5fdf | 68 | /* DRAW THE LEVEL */ |
RichardE | 0:5fa232ee5fdf | 69 | /******************/ |
RichardE | 0:5fa232ee5fdf | 70 | void DrawLevel( void ); |
RichardE | 0:5fa232ee5fdf | 71 | |
RichardE | 0:5fa232ee5fdf | 72 | /************************************************/ |
RichardE | 0:5fa232ee5fdf | 73 | /* HANDLE COLLISIONS BETWEEN HUMANS AND ENEMIES */ |
RichardE | 0:5fa232ee5fdf | 74 | /************************************************/ |
RichardE | 0:5fa232ee5fdf | 75 | // Pass index of human in level's humans array in humanIndex. |
RichardE | 0:5fa232ee5fdf | 76 | // Pass sprite number of sprite that it hit in spriteNumber. |
RichardE | 0:5fa232ee5fdf | 77 | static void HandleHumanCollision( UInt8 humanIndex, UInt8 spriteNumber ); |
RichardE | 0:5fa232ee5fdf | 78 | |
RichardE | 0:5fa232ee5fdf | 79 | /********************************************************/ |
RichardE | 0:5fa232ee5fdf | 80 | /* HANDLE COLLISIONS BETWEEN PLAYER BULLETS AND ENEMIES */ |
RichardE | 0:5fa232ee5fdf | 81 | /********************************************************/ |
RichardE | 0:5fa232ee5fdf | 82 | // Pass index of bullet in player's bullet array in bulletIndex. |
RichardE | 0:5fa232ee5fdf | 83 | // Pass sprite number of sprite that it hit in spriteNumber. |
RichardE | 0:5fa232ee5fdf | 84 | static void HandleBulletCollision( UInt8 bulletIndex, UInt8 spriteNumber ); |
RichardE | 0:5fa232ee5fdf | 85 | |
RichardE | 0:5fa232ee5fdf | 86 | /*********************************************************/ |
RichardE | 0:5fa232ee5fdf | 87 | /* CHECK FOR COLLISIONS BETWEEN PLAYER AND OTHER OBJECTS */ |
RichardE | 0:5fa232ee5fdf | 88 | /*********************************************************/ |
RichardE | 0:5fa232ee5fdf | 89 | // Pass pointer to a flag that will be set true if player is dead in isDead parameter. |
RichardE | 0:5fa232ee5fdf | 90 | void CheckPlayerCollisions( bool *isDead ); |
RichardE | 0:5fa232ee5fdf | 91 | |
RichardE | 0:5fa232ee5fdf | 92 | /***********************************************************************************/ |
RichardE | 0:5fa232ee5fdf | 93 | /* WAIT UNTIL SLOT FREE FOR A NEW SOUND, PLAY IT AND WAIT FOR ALL SOUNDS TO FINISH */ |
RichardE | 0:5fa232ee5fdf | 94 | /***********************************************************************************/ |
RichardE | 0:5fa232ee5fdf | 95 | // Pass sound to play in soundToPlay parameter. |
RichardE | 0:5fa232ee5fdf | 96 | static void PlaySoundAndWait( const UInt8 *soundToPlay ); |
RichardE | 0:5fa232ee5fdf | 97 | |
RichardE | 0:5fa232ee5fdf | 98 | }; |
RichardE | 0:5fa232ee5fdf | 99 | |
RichardE | 0:5fa232ee5fdf | 100 | #endif |
RichardE | 0:5fa232ee5fdf | 101 | |
RichardE | 0:5fa232ee5fdf | 102 | /* END of LevelNormal.h */ |
RichardE | 0:5fa232ee5fdf | 103 |