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
Child:
10:bfa1c307c99d
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 : BrainObject.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 BrainObjectIncluded
RichardE 7:e72691603fd3 9
RichardE 7:e72691603fd3 10 #define BrainObjectIncluded
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 #include "BrainBulletObject.h"
RichardE 7:e72691603fd3 16
RichardE 7:e72691603fd3 17 class BrainObject : public EnemyObject {
RichardE 7:e72691603fd3 18
RichardE 7:e72691603fd3 19 public :
RichardE 7:e72691603fd3 20
RichardE 7:e72691603fd3 21 // Points to an array of humans to chase.
RichardE 7:e72691603fd3 22 GameObject **HumansToChase;
RichardE 7:e72691603fd3 23
RichardE 7:e72691603fd3 24 /***************/
RichardE 7:e72691603fd3 25 /* CONSTRUCTOR */
RichardE 7:e72691603fd3 26 /***************/
RichardE 7:e72691603fd3 27 BrainObject();
RichardE 7:e72691603fd3 28
RichardE 7:e72691603fd3 29 /**************/
RichardE 7:e72691603fd3 30 /* DESTRUCTOR */
RichardE 7:e72691603fd3 31 /**************/
RichardE 7:e72691603fd3 32 virtual ~BrainObject();
RichardE 7:e72691603fd3 33
RichardE 7:e72691603fd3 34 /*****************************/
RichardE 7:e72691603fd3 35 /* GET TYPE OF ENEMY THIS IS */
RichardE 7:e72691603fd3 36 /*****************************/
RichardE 7:e72691603fd3 37 // Returns enemy type.
RichardE 7:e72691603fd3 38 virtual EnemyType GetEnemyType( void ) {
RichardE 7:e72691603fd3 39 return Brain;
RichardE 7:e72691603fd3 40 }
RichardE 7:e72691603fd3 41
RichardE 7:e72691603fd3 42 /*******************************************************/
RichardE 7:e72691603fd3 43 /* GET NUMBER OF POINTS AWARDED FOR KILLING THIS ENEMY */
RichardE 7:e72691603fd3 44 /*******************************************************/
RichardE 7:e72691603fd3 45 // Returns number of points.
RichardE 7:e72691603fd3 46 virtual UInt8 GetPoints( void ) {
RichardE 7:e72691603fd3 47 return 0x20; // BCD!
RichardE 7:e72691603fd3 48 }
RichardE 7:e72691603fd3 49
RichardE 7:e72691603fd3 50 /************************/
RichardE 7:e72691603fd3 51 /* MOVE THE GAME OBJECT */
RichardE 7:e72691603fd3 52 /************************/
RichardE 7:e72691603fd3 53 virtual void ProtectedMove( void );
RichardE 7:e72691603fd3 54
RichardE 7:e72691603fd3 55 /************************/
RichardE 7:e72691603fd3 56 /* DRAW THE GAME OBJECT */
RichardE 7:e72691603fd3 57 /************************/
RichardE 7:e72691603fd3 58 // This is only called after it has been established that the
RichardE 7:e72691603fd3 59 // game object is visible.
RichardE 7:e72691603fd3 60 virtual void Draw( Gameduino *gd );
RichardE 7:e72691603fd3 61
RichardE 7:e72691603fd3 62 private :
RichardE 7:e72691603fd3 63
RichardE 7:e72691603fd3 64 enum {
RichardE 7:e72691603fd3 65 BrainSpeed = 24, // speed at which brains move towards their prey
RichardE 7:e72691603fd3 66 };
RichardE 7:e72691603fd3 67
RichardE 7:e72691603fd3 68 bool bulletActive; // true if a bullet fired by this brain is zipping around
RichardE 7:e72691603fd3 69 UInt8 bulletIndex; // index of active bullet in enemies array
RichardE 7:e72691603fd3 70 BrainBulletObject bullet; // the bullet belonging to this brain
RichardE 7:e72691603fd3 71
RichardE 7:e72691603fd3 72 /******************************************************/
RichardE 7:e72691603fd3 73 /* DETERMINE IF A HUMAN IS A VALID TARGET FOR A BRAIN */
RichardE 7:e72691603fd3 74 /******************************************************/
RichardE 7:e72691603fd3 75 // Returns true if object is a human that is valid for targeting by brain.
RichardE 7:e72691603fd3 76 static bool ValidHuman( GameObject *object );
RichardE 7:e72691603fd3 77
RichardE 7:e72691603fd3 78 /******************/
RichardE 7:e72691603fd3 79 /* START A BULLET */
RichardE 7:e72691603fd3 80 /******************/
RichardE 7:e72691603fd3 81 // Pass sprite number to use in spriteNumber.
RichardE 7:e72691603fd3 82 // Returns pointer to bullet object or NULL on failure.
RichardE 7:e72691603fd3 83 BrainBulletObject *StartBullet( UInt8 spriteNumber );
RichardE 7:e72691603fd3 84
RichardE 7:e72691603fd3 85 };
RichardE 7:e72691603fd3 86
RichardE 7:e72691603fd3 87 #endif
RichardE 7:e72691603fd3 88
RichardE 7:e72691603fd3 89 /* END of BrainObject.h */
RichardE 7:e72691603fd3 90