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
Walker.h@7:e72691603fd3, 2013-06-08 (annotated)
- Committer:
- RichardE
- Date:
- Sat Jun 08 16:44:54 2013 +0000
- Revision:
- 7:e72691603fd3
Now have grunts wandering around on level 1. They follow the player but since no collision detection logic yet nobody ever gets killed.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
RichardE | 7:e72691603fd3 | 1 | /* |
RichardE | 7:e72691603fd3 | 2 | * SOURCE FILE : Walker.h |
RichardE | 7:e72691603fd3 | 3 | * |
RichardE | 7:e72691603fd3 | 4 | * Methods for objects that walk sideways on (like humans and crushers). |
RichardE | 7:e72691603fd3 | 5 | * |
RichardE | 7:e72691603fd3 | 6 | */ |
RichardE | 7:e72691603fd3 | 7 | |
RichardE | 7:e72691603fd3 | 8 | #ifndef WalkerDefined |
RichardE | 7:e72691603fd3 | 9 | |
RichardE | 7:e72691603fd3 | 10 | #define WalkerDefined |
RichardE | 7:e72691603fd3 | 11 | |
RichardE | 7:e72691603fd3 | 12 | #include "Types.h" |
RichardE | 7:e72691603fd3 | 13 | #include "GameObject.h" |
RichardE | 7:e72691603fd3 | 14 | |
RichardE | 7:e72691603fd3 | 15 | class Walker { |
RichardE | 7:e72691603fd3 | 16 | |
RichardE | 7:e72691603fd3 | 17 | public : |
RichardE | 7:e72691603fd3 | 18 | |
RichardE | 7:e72691603fd3 | 19 | enum { |
RichardE | 7:e72691603fd3 | 20 | AnimationStages = 4, |
RichardE | 7:e72691603fd3 | 21 | }; |
RichardE | 7:e72691603fd3 | 22 | |
RichardE | 7:e72691603fd3 | 23 | /*************************************************/ |
RichardE | 7:e72691603fd3 | 24 | /* INITIALISE HORIZONTAL AND VERTICAL VELOCITIES */ |
RichardE | 7:e72691603fd3 | 25 | /*************************************************/ |
RichardE | 7:e72691603fd3 | 26 | // Pass pointers to horizontal and vertical velocities in hv and vv. |
RichardE | 7:e72691603fd3 | 27 | static void InitialiseVelocities( Int16 *hv, Int16 *vv ); |
RichardE | 7:e72691603fd3 | 28 | |
RichardE | 7:e72691603fd3 | 29 | /*********************************************************/ |
RichardE | 7:e72691603fd3 | 30 | /* UPDATE COORDINATES AND VELOCITIES TO MAKE OBJECT WALK */ |
RichardE | 7:e72691603fd3 | 31 | /*********************************************************/ |
RichardE | 7:e72691603fd3 | 32 | // Pass pointers to x and y coordinates in x and y. |
RichardE | 7:e72691603fd3 | 33 | // Pass pointers to horizontal and vertical velocities in hv and vv. |
RichardE | 7:e72691603fd3 | 34 | // Pass restriction flags (as defined in GameObject.h) in restriction Flags. |
RichardE | 7:e72691603fd3 | 35 | static void Walk( Int16 *x, Int16 *y, Int16 *hv, Int16 *vv, UInt8 restrictionFlags ); |
RichardE | 7:e72691603fd3 | 36 | |
RichardE | 7:e72691603fd3 | 37 | /*************************/ |
RichardE | 7:e72691603fd3 | 38 | /* DRAW A WALKING OBJECT */ |
RichardE | 7:e72691603fd3 | 39 | /*************************/ |
RichardE | 7:e72691603fd3 | 40 | // Pass pointer to Gameduino to draw on in gd. |
RichardE | 7:e72691603fd3 | 41 | // Pass sprite number in spriteNumber. |
RichardE | 7:e72691603fd3 | 42 | // Pass x and y coordinates in x and y (NOT pixel coordinates). |
RichardE | 7:e72691603fd3 | 43 | // Pass horizontal velocity in hv. |
RichardE | 7:e72691603fd3 | 44 | // Pass counter used to pace animation in frameCounter. |
RichardE | 7:e72691603fd3 | 45 | // Pass pointer to animation data (array of AnimationStages sprite image numbers) in animationData. |
RichardE | 7:e72691603fd3 | 46 | static void Draw( Gameduino *gd, UInt8 spriteNumber, Int16 x, Int16 y, Int16 hv, UInt8 frameCounter, const UInt8 *animationData ); |
RichardE | 7:e72691603fd3 | 47 | |
RichardE | 7:e72691603fd3 | 48 | private : |
RichardE | 7:e72691603fd3 | 49 | |
RichardE | 7:e72691603fd3 | 50 | }; |
RichardE | 7:e72691603fd3 | 51 | |
RichardE | 7:e72691603fd3 | 52 | #endif |
RichardE | 7:e72691603fd3 | 53 | |
RichardE | 7:e72691603fd3 | 54 | /* END of Walker.h */ |
RichardE | 7:e72691603fd3 | 55 |