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 14:40:47 2013 +0000
Revision:
5:0b0651ac7832
Parent:
4:673eb9735d44
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?

UserRevisionLine numberNew contents of line
RichardE 4:673eb9735d44 1 /*
RichardE 4:673eb9735d44 2 * SOURCE FILE : BulletManager.h
RichardE 4:673eb9735d44 3 *
RichardE 4:673eb9735d44 4 * Responsible for managing a collection of bullets.
RichardE 4:673eb9735d44 5 *
RichardE 4:673eb9735d44 6 */
RichardE 4:673eb9735d44 7
RichardE 4:673eb9735d44 8 #ifndef BulletManagerIncluded
RichardE 4:673eb9735d44 9
RichardE 4:673eb9735d44 10 #define BulletManagerIncluded
RichardE 4:673eb9735d44 11
RichardE 4:673eb9735d44 12 #include "Types.h"
RichardE 4:673eb9735d44 13 #include "BulletObject.h"
RichardE 5:0b0651ac7832 14 #include "Gameduino.h"
RichardE 4:673eb9735d44 15
RichardE 4:673eb9735d44 16 class BulletManager {
RichardE 4:673eb9735d44 17
RichardE 4:673eb9735d44 18 public :
RichardE 4:673eb9735d44 19
RichardE 4:673eb9735d44 20 enum {
RichardE 4:673eb9735d44 21 MaxBullets = 20, // maximum number of bullets on the go at one tine.
RichardE 4:673eb9735d44 22 };
RichardE 4:673eb9735d44 23
RichardE 4:673eb9735d44 24 /***************/
RichardE 4:673eb9735d44 25 /* CONSTRUCTOR */
RichardE 4:673eb9735d44 26 /***************/
RichardE 4:673eb9735d44 27 // Pass number of sprite to use for first bullet.
RichardE 4:673eb9735d44 28 // MaxBullets consequtive sprites will be used for bullets.
RichardE 4:673eb9735d44 29 BulletManager( UInt8 firstSpriteNumber );
RichardE 4:673eb9735d44 30
RichardE 4:673eb9735d44 31 /**********************/
RichardE 4:673eb9735d44 32 /* START A BULLET OFF */
RichardE 4:673eb9735d44 33 /**********************/
RichardE 4:673eb9735d44 34 // Pass start coordinates in x and y (NOT pixel coordinates).
RichardE 4:673eb9735d44 35 // Pass bullet velocities in hv and vv (NOT pixel velocities).
RichardE 4:673eb9735d44 36 // Returns true if bullet was started successfully.
RichardE 4:673eb9735d44 37 bool StartBullet( Int16 x, Int16 y, Int16 hv, Int16 vv );
RichardE 4:673eb9735d44 38
RichardE 4:673eb9735d44 39 /************************/
RichardE 4:673eb9735d44 40 /* KILL A SINGLE BULLET */
RichardE 4:673eb9735d44 41 /************************/
RichardE 5:0b0651ac7832 42 // Pass pointer to Gameduino that displays bullets in gd.
RichardE 4:673eb9735d44 43 // Pass index of bullet in b.
RichardE 5:0b0651ac7832 44 void KillBullet( Gameduino *gd, UInt8 b );
RichardE 4:673eb9735d44 45
RichardE 4:673eb9735d44 46 /********************/
RichardE 4:673eb9735d44 47 /* KILL ALL BULLETS */
RichardE 4:673eb9735d44 48 /********************/
RichardE 5:0b0651ac7832 49 // Pass pointer to Gameduino that displays bullets in gd.
RichardE 5:0b0651ac7832 50 void KillAllBullets( Gameduino *gd );
RichardE 4:673eb9735d44 51
RichardE 4:673eb9735d44 52 /************************************************/
RichardE 4:673eb9735d44 53 /* GET ARRAY CONTAINING POINTERS TO ALL BULLETS */
RichardE 4:673eb9735d44 54 /************************************************/
RichardE 4:673eb9735d44 55 // Returns pointer to array of GameObject pointers.
RichardE 4:673eb9735d44 56 // The array has BulletManager::MaxBullets pointers in it.
RichardE 4:673eb9735d44 57 GameObject **GetBullets( void ) {
RichardE 4:673eb9735d44 58 return bulletPointers;
RichardE 4:673eb9735d44 59 }
RichardE 4:673eb9735d44 60
RichardE 4:673eb9735d44 61 private :
RichardE 4:673eb9735d44 62
RichardE 4:673eb9735d44 63 // All the bullets.
RichardE 4:673eb9735d44 64 BulletObject bullets[ MaxBullets ];
RichardE 4:673eb9735d44 65
RichardE 4:673eb9735d44 66 // Pointers to all the bullets.
RichardE 4:673eb9735d44 67 // Entries in this array will be NULL for bullets that are not active.
RichardE 4:673eb9735d44 68 // When bullet is active it will point to the corresponding entry in the bullets array.
RichardE 4:673eb9735d44 69 GameObject *bulletPointers[ MaxBullets ];
RichardE 4:673eb9735d44 70
RichardE 4:673eb9735d44 71 };
RichardE 4:673eb9735d44 72
RichardE 4:673eb9735d44 73 #endif
RichardE 4:673eb9735d44 74
RichardE 4:673eb9735d44 75 /* END of BulletManager.h */
RichardE 4:673eb9735d44 76