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:
Sat Jun 08 17:51:33 2013 +0000
Revision:
8:82d88f9381f3
Enemies, humans, explosions, collisions all working now. Sound is still missing and there are only 2 levels.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
RichardE 8:82d88f9381f3 1 /*
RichardE 8:82d88f9381f3 2 * SOURCE FILE : MutantObject.h
RichardE 8:82d88f9381f3 3 *
RichardE 8:82d88f9381f3 4 * Represents a mutated human.
RichardE 8:82d88f9381f3 5 *
RichardE 8:82d88f9381f3 6 */
RichardE 8:82d88f9381f3 7
RichardE 8:82d88f9381f3 8 #ifndef MutantObjectIncluded
RichardE 8:82d88f9381f3 9
RichardE 8:82d88f9381f3 10 #define MutantObjectIncluded
RichardE 8:82d88f9381f3 11
RichardE 8:82d88f9381f3 12 #include "EnemyObject.h"
RichardE 8:82d88f9381f3 13 #include "SpriteImageId.h"
RichardE 8:82d88f9381f3 14 #include "FrameCounter.h"
RichardE 8:82d88f9381f3 15 #include "Direction4.h"
RichardE 8:82d88f9381f3 16 #include "HumanObject.h"
RichardE 8:82d88f9381f3 17
RichardE 8:82d88f9381f3 18 class MutantObject : public EnemyObject {
RichardE 8:82d88f9381f3 19
RichardE 8:82d88f9381f3 20 public :
RichardE 8:82d88f9381f3 21
RichardE 8:82d88f9381f3 22 // Number for sprite image used.
RichardE 8:82d88f9381f3 23 UInt8 SpriteImage;
RichardE 8:82d88f9381f3 24
RichardE 8:82d88f9381f3 25 /***************/
RichardE 8:82d88f9381f3 26 /* CONSTRUCTOR */
RichardE 8:82d88f9381f3 27 /***************/
RichardE 8:82d88f9381f3 28 MutantObject() :
RichardE 8:82d88f9381f3 29 SpriteImage( MutantWomanImage ),
RichardE 8:82d88f9381f3 30 direction( UpDir4 )
RichardE 8:82d88f9381f3 31 {
RichardE 8:82d88f9381f3 32 }
RichardE 8:82d88f9381f3 33
RichardE 8:82d88f9381f3 34 /**************/
RichardE 8:82d88f9381f3 35 /* DESTRUCTOR */
RichardE 8:82d88f9381f3 36 /**************/
RichardE 8:82d88f9381f3 37 virtual ~MutantObject() {
RichardE 8:82d88f9381f3 38 }
RichardE 8:82d88f9381f3 39
RichardE 8:82d88f9381f3 40 /*****************************/
RichardE 8:82d88f9381f3 41 /* GET TYPE OF ENEMY THIS IS */
RichardE 8:82d88f9381f3 42 /*****************************/
RichardE 8:82d88f9381f3 43 // Returns enemy type.
RichardE 8:82d88f9381f3 44 virtual EnemyType GetEnemyType( void ) {
RichardE 8:82d88f9381f3 45 return Grunt;
RichardE 8:82d88f9381f3 46 }
RichardE 8:82d88f9381f3 47
RichardE 8:82d88f9381f3 48 /*******************************************************/
RichardE 8:82d88f9381f3 49 /* GET NUMBER OF POINTS AWARDED FOR KILLING THIS ENEMY */
RichardE 8:82d88f9381f3 50 /*******************************************************/
RichardE 8:82d88f9381f3 51 // Returns number of points.
RichardE 8:82d88f9381f3 52 virtual UInt8 GetPoints( void ) {
RichardE 8:82d88f9381f3 53 return 0x5; // In BCD!
RichardE 8:82d88f9381f3 54 }
RichardE 8:82d88f9381f3 55
RichardE 8:82d88f9381f3 56 /**********************/
RichardE 8:82d88f9381f3 57 /* START OFF A MUTANT */
RichardE 8:82d88f9381f3 58 /**********************/
RichardE 8:82d88f9381f3 59 // Pass pointer to human mutant will replace in human.
RichardE 8:82d88f9381f3 60 // Pass pointer to object it will chase in player.
RichardE 8:82d88f9381f3 61 void Start( HumanObject *human, GameObject *player );
RichardE 8:82d88f9381f3 62
RichardE 8:82d88f9381f3 63 /************************/
RichardE 8:82d88f9381f3 64 /* MOVE THE GAME OBJECT */
RichardE 8:82d88f9381f3 65 /************************/
RichardE 8:82d88f9381f3 66 virtual void ProtectedMove( void );
RichardE 8:82d88f9381f3 67
RichardE 8:82d88f9381f3 68 /************************/
RichardE 8:82d88f9381f3 69 /* DRAW THE GAME OBJECT */
RichardE 8:82d88f9381f3 70 /************************/
RichardE 8:82d88f9381f3 71 // This is only called after it has been established that the
RichardE 8:82d88f9381f3 72 // game object is visible.
RichardE 8:82d88f9381f3 73 virtual void Draw( Gameduino *gd ) {
RichardE 8:82d88f9381f3 74 Gameduino::Rotation transform = ( FrameCounter & 8 ) ? Gameduino::FlipX : Gameduino::None;
RichardE 8:82d88f9381f3 75 gd->sprite( SpriteNumber, ToPixel( Xco ), ToPixel( Yco ), SpriteImage, 0, transform, BadGuy );
RichardE 8:82d88f9381f3 76 }
RichardE 8:82d88f9381f3 77
RichardE 8:82d88f9381f3 78 private :
RichardE 8:82d88f9381f3 79
RichardE 8:82d88f9381f3 80 // Speed at which mutants move.
RichardE 8:82d88f9381f3 81 static Int16 mutantSpeed;
RichardE 8:82d88f9381f3 82
RichardE 8:82d88f9381f3 83 // Direction mutant is moving.
RichardE 8:82d88f9381f3 84 Direction4 direction;
RichardE 8:82d88f9381f3 85
RichardE 8:82d88f9381f3 86 };
RichardE 8:82d88f9381f3 87
RichardE 8:82d88f9381f3 88 #endif
RichardE 8:82d88f9381f3 89
RichardE 8:82d88f9381f3 90 /* END of MutantObject.h */
RichardE 8:82d88f9381f3 91