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: OneShotObject.cpp
- Revision:
- 8:82d88f9381f3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/OneShotObject.cpp Sat Jun 08 17:51:33 2013 +0000 @@ -0,0 +1,29 @@ +/* + * SOURCE FILE : OneShotObject.cpp + * + * Base class for all objects that do not move and play an animation once before vanishing. + * Useful for explosions and popup scores. + * + */ + +#include "OneShotObject.h" + +/************************/ +/* MOVE THE GAME OBJECT */ +/************************/ +void OneShotObject::ProtectedMove( void ) { + if( imageCountdown > 0 ) { + // Not time to change image yet. + imageCountdown--; + } + else if( imageNumber >= lastImageNumber ) { + // Animation completed. Make game object invisible. + Visible = false; + } + else { + // Move on to next image in the animation. + imageNumber++; + imageCountdown = maxCountdown; + } +} +