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@18:70190f956a24, 2013-06-17 (annotated)
- Committer:
- RichardE
- Date:
- Mon Jun 17 15:10:43 2013 +0000
- Revision:
- 18:70190f956a24
- Parent:
- 8:82d88f9381f3
Improved response to button 1 when entering high scores (HighScoreEntry.cpp).
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
RichardE | 8:82d88f9381f3 | 1 | /* |
RichardE | 8:82d88f9381f3 | 2 | * SOURCE FILE : OneShotObject.cpp |
RichardE | 8:82d88f9381f3 | 3 | * |
RichardE | 8:82d88f9381f3 | 4 | * Base class for all objects that do not move and play an animation once before vanishing. |
RichardE | 8:82d88f9381f3 | 5 | * Useful for explosions and popup scores. |
RichardE | 8:82d88f9381f3 | 6 | * |
RichardE | 8:82d88f9381f3 | 7 | */ |
RichardE | 8:82d88f9381f3 | 8 | |
RichardE | 8:82d88f9381f3 | 9 | #include "OneShotObject.h" |
RichardE | 8:82d88f9381f3 | 10 | |
RichardE | 8:82d88f9381f3 | 11 | /************************/ |
RichardE | 8:82d88f9381f3 | 12 | /* MOVE THE GAME OBJECT */ |
RichardE | 8:82d88f9381f3 | 13 | /************************/ |
RichardE | 8:82d88f9381f3 | 14 | void OneShotObject::ProtectedMove( void ) { |
RichardE | 8:82d88f9381f3 | 15 | if( imageCountdown > 0 ) { |
RichardE | 8:82d88f9381f3 | 16 | // Not time to change image yet. |
RichardE | 8:82d88f9381f3 | 17 | imageCountdown--; |
RichardE | 8:82d88f9381f3 | 18 | } |
RichardE | 8:82d88f9381f3 | 19 | else if( imageNumber >= lastImageNumber ) { |
RichardE | 8:82d88f9381f3 | 20 | // Animation completed. Make game object invisible. |
RichardE | 8:82d88f9381f3 | 21 | Visible = false; |
RichardE | 8:82d88f9381f3 | 22 | } |
RichardE | 8:82d88f9381f3 | 23 | else { |
RichardE | 8:82d88f9381f3 | 24 | // Move on to next image in the animation. |
RichardE | 8:82d88f9381f3 | 25 | imageNumber++; |
RichardE | 8:82d88f9381f3 | 26 | imageCountdown = maxCountdown; |
RichardE | 8:82d88f9381f3 | 27 | } |
RichardE | 8:82d88f9381f3 | 28 | } |
RichardE | 8:82d88f9381f3 | 29 |