graze counter for the HUD

This commit is contained in:
Andrew "Akari" Alexeyew 2012-08-13 20:10:41 +03:00
parent 6a56d49af2
commit ff095d231b
6 changed files with 7 additions and 2 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 172 KiB

After

Width:  |  Height:  |  Size: 180 KiB

Binary file not shown.

View file

@ -17,10 +17,10 @@ void init_player(Player* plr) {
memset(plr, 0, sizeof(Player));
plr->pos = VIEWPORT_W/2 + I*(VIEWPORT_H-20);
plr->lifes = PLR_START_LIVES;
plr->bombs = PLR_START_BOMBS;
plr->deathtime = -1;
plr->continues = 0;
}

View file

@ -44,6 +44,7 @@ typedef struct {
short dir;
float power;
int graze;
int lifes;
int bombs;

View file

@ -79,6 +79,7 @@ int collision_projectile(Projectile *p) {
if(!p->grazed && dst < grazer && global.frames - abs(global.plr.recovery) > 0) {
p->grazed = True;
global.points += 10;
global.plr.graze++;
play_sound("graze");
int i = 0; for(i = 0; i < 5; ++i) {

View file

@ -199,6 +199,9 @@ void draw_hud(void) {
sprintf(buf, "%.2f", global.plr.power);
draw_text(AL_Center, 10, 236, buf, _fonts.standard);
sprintf(buf, "%i", global.plr.graze);
draw_text(AL_Left, -5, 270, buf, _fonts.standard);
sprintf(buf, "%i", global.points);
draw_text(AL_Center, 13, 49, buf, _fonts.standard);