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

OneShotObject.cpp

Committer:
RichardE
Date:
2013-06-17
Revision:
18:70190f956a24
Parent:
8:82d88f9381f3

File content as of revision 18:70190f956a24:

/*
 * 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;
  }
}