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

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers MutantObject.h Source File

MutantObject.h

00001 /*
00002  * SOURCE FILE : MutantObject.h
00003  *
00004  * Represents a mutated human.
00005  *
00006  */
00007 
00008 #ifndef MutantObjectIncluded
00009   
00010   #define MutantObjectIncluded
00011 
00012   #include "EnemyObject.h"
00013   #include "SpriteImageId.h"
00014   #include "FrameCounter.h"
00015   #include "Direction4.h"
00016   #include "HumanObject.h"
00017   
00018   class MutantObject : public EnemyObject {
00019     
00020   public :
00021 
00022         // Number for sprite image used.
00023         UInt8 SpriteImage;
00024         
00025     /***************/
00026     /* CONSTRUCTOR */
00027     /***************/
00028     MutantObject() :
00029             SpriteImage( MutantWomanImage ),
00030             direction( UpDir4 )
00031         {
00032     }
00033 
00034     /**************/
00035     /* DESTRUCTOR */
00036     /**************/
00037     virtual ~MutantObject() {
00038     }
00039     
00040         /*****************************/
00041         /* GET TYPE OF ENEMY THIS IS */
00042         /*****************************/
00043         // Returns enemy type.
00044         virtual EnemyType GetEnemyType( void ) {
00045             return Grunt;
00046         }
00047 
00048     /*******************************************************/
00049     /* GET NUMBER OF POINTS AWARDED FOR KILLING THIS ENEMY */
00050     /*******************************************************/
00051     // Returns number of points.
00052     virtual UInt8 GetPoints( void ) {
00053       return 0x5;  // In BCD!
00054     }
00055 
00056         /**********************/
00057         /* START OFF A MUTANT */
00058         /**********************/
00059         // Pass pointer to human mutant will replace in human.
00060         // Pass pointer to object it will chase in player.
00061         void Start( HumanObject *human, GameObject *player );
00062         
00063     /************************/
00064     /* MOVE THE GAME OBJECT */
00065     /************************/
00066     virtual void ProtectedMove( void );
00067 
00068     /************************/
00069     /* DRAW THE GAME OBJECT */
00070     /************************/
00071     // This is only called after it has been established that the
00072     // game object is visible.
00073     virtual void Draw( Gameduino *gd ) {
00074       Gameduino::Rotation transform = ( FrameCounter & 8 ) ? Gameduino::FlipX : Gameduino::None;
00075       gd->sprite( SpriteNumber, ToPixel( Xco ), ToPixel( Yco ), SpriteImage, 0, transform, BadGuy );
00076     }
00077    
00078   private :
00079   
00080     // Speed at which mutants move.
00081     static Int16 mutantSpeed;
00082     
00083         // Direction mutant is moving.
00084         Direction4 direction;
00085         
00086   };
00087     
00088 #endif
00089 
00090 /* END of MutantObject.h */
00091