graze counter for the HUD
This commit is contained in:
parent
6a56d49af2
commit
ff095d231b
6 changed files with 7 additions and 2 deletions
BIN
gfx/hud.png
BIN
gfx/hud.png
Binary file not shown.
Before Width: | Height: | Size: 172 KiB After Width: | Height: | Size: 180 KiB |
BIN
gfx/hud.xcf
BIN
gfx/hud.xcf
Binary file not shown.
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -44,6 +44,7 @@ typedef struct {
|
|||
|
||||
short dir;
|
||||
float power;
|
||||
int graze;
|
||||
|
||||
int lifes;
|
||||
int bombs;
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in a new issue