Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
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;
  }
}