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
Diff: BulletObject.h
- Revision:
- 4:673eb9735d44
- Child:
- 5:0b0651ac7832
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/BulletObject.h Sat Jun 08 11:24:05 2013 +0000 @@ -0,0 +1,90 @@ +/* + * SOURCE FILE : BulletObject.h + * + * Represents a bullet type objects with horizontal and vertical velocities. + * + */ + +#ifndef BulletObjectIncluded + + #define BulletObjectIncluded + + #include "Gameduino.h" + #include "GameObject.h" + #include "SpriteImageId.h" + #include "SpriteGroup.h" + + class BulletObject : public GameObject { + + public : + + /***************/ + /* CONSTRUCTOR */ + /***************/ + BulletObject() : + imageNumber( PlayerBulletImage ), + spriteGroup( GoodGuy ) + { + DeleteWhenRestricted = true; + } + + /**************/ + /* DESTRUCTOR */ + /**************/ + virtual ~BulletObject() { + } + + /************************/ + /* GET GAME OBJECT TYPE */ + /************************/ + // Returns type of game object. + virtual GameObjectTypes GetType( void ) { + return BulletObjectType; + } + + /****************/ + /* START BULLET */ + /****************/ + void Start( Int16 x, Int16 y, Int16 hv, Int16 vv ) { + Xco = x; + Yco = y; + hSpeed = hv; + vSpeed = vv; + Visible = true; + } + + /************************/ + /* MOVE THE GAME OBJECT */ + /************************/ + virtual void ProtectedMove( void ) { + Xco += hSpeed; + Yco += vSpeed; + } + + /************************/ + /* DRAW THE GAME OBJECT */ + /************************/ + // This is only called after it has been established that the + // game object is visible. + virtual void Draw( void ) { + // GD.sprite( SpriteNumber, ToPixel( Xco ), ToPixel( Yco ), imageNumber, 0, 0, spriteGroup ); + } + + private : + + // Number of sprite image used for bullet. + SpriteImageId imageNumber; + + // Indicates whether these are good or bad bullets for + // purposes of collision detection. + SpriteGroup spriteGroup; + + // Horizontal and vertical velocities. + Int16 hSpeed, vSpeed; + + }; + +#endif + +/* END of BulletObject.h */ +