Invaders game for the Gameduino

Dependencies:   Gameduino mbed

Committer:
TheChrisyd
Date:
Thu Jun 21 19:13:34 2012 +0000
Revision:
0:8a7c58553b44
Child:
1:f44175dd69fd
backup before adding more features

Who changed what in which revision?

UserRevisionLine numberNew contents of line
TheChrisyd 0:8a7c58553b44 1 /*---------------------------------------------
TheChrisyd 0:8a7c58553b44 2 Send all graphics to the Gameduino
TheChrisyd 0:8a7c58553b44 3 ---------------------------------------------*/
TheChrisyd 0:8a7c58553b44 4 #ifndef INVADER_GRAPHICS
TheChrisyd 0:8a7c58553b44 5 #define INVADER_GRAPHICS
TheChrisyd 0:8a7c58553b44 6 #include "shield.h"
TheChrisyd 0:8a7c58553b44 7 #include "mbed.h"
TheChrisyd 0:8a7c58553b44 8 #include "arduino.h"
TheChrisyd 0:8a7c58553b44 9 void makeGraphics();
TheChrisyd 0:8a7c58553b44 10
TheChrisyd 0:8a7c58553b44 11 /*---------------------------------------------
TheChrisyd 0:8a7c58553b44 12 Identifiers for custom chars
TheChrisyd 0:8a7c58553b44 13 ---------------------------------------------*/
TheChrisyd 0:8a7c58553b44 14 enum char_id {
TheChrisyd 0:8a7c58553b44 15 CH_FLOOR=128,
TheChrisyd 0:8a7c58553b44 16 CH_PLAYERL,
TheChrisyd 0:8a7c58553b44 17 CH_PLAYERR
TheChrisyd 0:8a7c58553b44 18 };
TheChrisyd 0:8a7c58553b44 19 /*---------------------------------------------
TheChrisyd 0:8a7c58553b44 20 Identifiers for each sprite graphic
TheChrisyd 0:8a7c58553b44 21
TheChrisyd 0:8a7c58553b44 22 Sprites are made in four color mode so
TheChrisyd 0:8a7c58553b44 23 each 'sprite' can have four images inside
TheChrisyd 0:8a7c58553b44 24 it.
TheChrisyd 0:8a7c58553b44 25
TheChrisyd 0:8a7c58553b44 26 The first image is usually the 'normal'
TheChrisyd 0:8a7c58553b44 27 (eg. player/saucer) one and the third is
TheChrisyd 0:8a7c58553b44 28 usually blank (so you can hide the sprite).
TheChrisyd 0:8a7c58553b44 29
TheChrisyd 0:8a7c58553b44 30 The other two are used for animations
TheChrisyd 0:8a7c58553b44 31 (eg. invaders) and explosions (eg. player)
TheChrisyd 0:8a7c58553b44 32 ---------------------------------------------*/
TheChrisyd 0:8a7c58553b44 33 enum graphic_id {
TheChrisyd 0:8a7c58553b44 34 // Invader sprites - Top, Middle, Bottom, two animation frames each...
TheChrisyd 0:8a7c58553b44 35 GR_INVADER_T,
TheChrisyd 0:8a7c58553b44 36 GR_INVADER_M,
TheChrisyd 0:8a7c58553b44 37 GR_INVADER_B,
TheChrisyd 0:8a7c58553b44 38 GR_BOMB_ZIGZAG, // Zigzag bomb
TheChrisyd 0:8a7c58553b44 39 GR_BOMB_BARS, // The bomb with rolling horizontal bars across it
TheChrisyd 0:8a7c58553b44 40 GR_BOMB_DIAG, // The bomb with diagonal bars across it
TheChrisyd 0:8a7c58553b44 41 GR_BOMB_OTHER, // Other bomb graphics (explosion and blank)
TheChrisyd 0:8a7c58553b44 42 // The player (with bullet)
TheChrisyd 0:8a7c58553b44 43 GR_PLAYER,
TheChrisyd 0:8a7c58553b44 44 GR_BULLET, // nb. Has a '0' in frame 2 (for the saucer...)
TheChrisyd 0:8a7c58553b44 45 // The saucer at the top
TheChrisyd 0:8a7c58553b44 46 GR_SAUCER,
TheChrisyd 0:8a7c58553b44 47 GR_SAUCER_SCORE,
TheChrisyd 0:8a7c58553b44 48 // Shields
TheChrisyd 0:8a7c58553b44 49 GR_SHIELD1,
TheChrisyd 0:8a7c58553b44 50 GR_SHIELD2,
TheChrisyd 0:8a7c58553b44 51 GR_SHIELD3,
TheChrisyd 0:8a7c58553b44 52 GR_SHIELD4
TheChrisyd 0:8a7c58553b44 53 };
TheChrisyd 0:8a7c58553b44 54
TheChrisyd 0:8a7c58553b44 55 /*---------------------------------------------
TheChrisyd 0:8a7c58553b44 56 Functions for wrecking/rebuilding shields
TheChrisyd 0:8a7c58553b44 57 ---------------------------------------------*/
TheChrisyd 0:8a7c58553b44 58 void remakeShields();
TheChrisyd 0:8a7c58553b44 59
TheChrisyd 0:8a7c58553b44 60 // Damage the shield with either a bomb or a bullet (ie. above/below)
TheChrisyd 0:8a7c58553b44 61 // n=shield number [0..4], x is relative to the shield's top-left corner
TheChrisyd 0:8a7c58553b44 62 int8 zapShield(byte n, int8 x, bool withBullet); // Return Y coordinate of blast
TheChrisyd 0:8a7c58553b44 63
TheChrisyd 0:8a7c58553b44 64 #endif
TheChrisyd 0:8a7c58553b44 65