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 16:44:54 2013 +0000
Revision:
7:e72691603fd3
Now have grunts wandering around on level 1. They follow the player but since no collision detection logic yet nobody ever gets killed.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
RichardE 7:e72691603fd3 1 /*
RichardE 7:e72691603fd3 2 * SOURCE FILE : CrusherObject.h
RichardE 7:e72691603fd3 3 *
RichardE 7:e72691603fd3 4 * Represents a wandering human.
RichardE 7:e72691603fd3 5 *
RichardE 7:e72691603fd3 6 */
RichardE 7:e72691603fd3 7
RichardE 7:e72691603fd3 8 #ifndef CrusherObjectIncluded
RichardE 7:e72691603fd3 9
RichardE 7:e72691603fd3 10 #define CrusherObjectIncluded
RichardE 7:e72691603fd3 11
RichardE 7:e72691603fd3 12 #include "Types.h"
RichardE 7:e72691603fd3 13 #include "EnemyObject.h"
RichardE 7:e72691603fd3 14 #include "GameObjectTypes.h"
RichardE 7:e72691603fd3 15
RichardE 7:e72691603fd3 16 class CrusherObject : public EnemyObject {
RichardE 7:e72691603fd3 17
RichardE 7:e72691603fd3 18 public :
RichardE 7:e72691603fd3 19
RichardE 7:e72691603fd3 20 /***************/
RichardE 7:e72691603fd3 21 /* CONSTRUCTOR */
RichardE 7:e72691603fd3 22 /***************/
RichardE 7:e72691603fd3 23 CrusherObject();
RichardE 7:e72691603fd3 24
RichardE 7:e72691603fd3 25 /**************/
RichardE 7:e72691603fd3 26 /* DESTRUCTOR */
RichardE 7:e72691603fd3 27 /**************/
RichardE 7:e72691603fd3 28 virtual ~CrusherObject();
RichardE 7:e72691603fd3 29
RichardE 7:e72691603fd3 30 /*****************************/
RichardE 7:e72691603fd3 31 /* GET TYPE OF ENEMY THIS IS */
RichardE 7:e72691603fd3 32 /*****************************/
RichardE 7:e72691603fd3 33 // Returns enemy type.
RichardE 7:e72691603fd3 34 virtual EnemyType GetEnemyType( void ) {
RichardE 7:e72691603fd3 35 return Crusher;
RichardE 7:e72691603fd3 36 }
RichardE 7:e72691603fd3 37
RichardE 7:e72691603fd3 38 /*******************************************************/
RichardE 7:e72691603fd3 39 /* GET NUMBER OF POINTS AWARDED FOR KILLING THIS ENEMY */
RichardE 7:e72691603fd3 40 /*******************************************************/
RichardE 7:e72691603fd3 41 // Returns number of points.
RichardE 7:e72691603fd3 42 virtual UInt8 GetPoints( void ) {
RichardE 7:e72691603fd3 43 return 0x10; // BCD!
RichardE 7:e72691603fd3 44 }
RichardE 7:e72691603fd3 45
RichardE 7:e72691603fd3 46 /************************/
RichardE 7:e72691603fd3 47 /* MOVE THE GAME OBJECT */
RichardE 7:e72691603fd3 48 /************************/
RichardE 7:e72691603fd3 49 virtual void ProtectedMove( void );
RichardE 7:e72691603fd3 50
RichardE 7:e72691603fd3 51 /************************/
RichardE 7:e72691603fd3 52 /* DRAW THE GAME OBJECT */
RichardE 7:e72691603fd3 53 /************************/
RichardE 7:e72691603fd3 54 // Pass pointer to a Gameduino to draw on in gd.
RichardE 7:e72691603fd3 55 // This is only called after it has been established that the
RichardE 7:e72691603fd3 56 // game object is visible.
RichardE 7:e72691603fd3 57 virtual void Draw( Gameduino *gd );
RichardE 7:e72691603fd3 58
RichardE 7:e72691603fd3 59 /********************************************/
RichardE 7:e72691603fd3 60 /* INFORM ENEMY IT HAS BEEN HIT BY A BULLET */
RichardE 7:e72691603fd3 61 /********************************************/
RichardE 7:e72691603fd3 62 // Default implementation does nothing but if special behaviour
RichardE 7:e72691603fd3 63 // is required in a derived class then this should be overridden.
RichardE 7:e72691603fd3 64 // Note that this does NOT deal with determining if the enemy is dead or not.
RichardE 7:e72691603fd3 65 // An enemy ALWAYS dies if HitPoints reaches zero.
RichardE 7:e72691603fd3 66 virtual void RegisterHitByBullet( void );
RichardE 7:e72691603fd3 67
RichardE 7:e72691603fd3 68 private :
RichardE 7:e72691603fd3 69
RichardE 7:e72691603fd3 70 // Address of animation data in program memory.
RichardE 7:e72691603fd3 71 const UInt8 *animationData;
RichardE 7:e72691603fd3 72
RichardE 7:e72691603fd3 73 // Horizontal and vertical velocities.
RichardE 7:e72691603fd3 74 Int16 hSpeed, vSpeed;
RichardE 7:e72691603fd3 75
RichardE 7:e72691603fd3 76 // Stun countdown. Crusher does not move until this reaches zero.
RichardE 7:e72691603fd3 77 UInt8 stunCountdown;
RichardE 7:e72691603fd3 78
RichardE 7:e72691603fd3 79 // Frame count at the moment crusher was stunned.
RichardE 7:e72691603fd3 80 UInt8 stunFrameCount;
RichardE 7:e72691603fd3 81
RichardE 7:e72691603fd3 82 };
RichardE 7:e72691603fd3 83
RichardE 7:e72691603fd3 84 #endif
RichardE 7:e72691603fd3 85
RichardE 7:e72691603fd3 86 /* END of CrusherObject.h */
RichardE 7:e72691603fd3 87