add HUD and skill icons
This commit is contained in:
parent
8e19f72a73
commit
89ee5234ea
|
@ -35,6 +35,10 @@ set(ASSETS
|
|||
# Levels
|
||||
assets-cg/levels/demo.txt
|
||||
assets-cg/levels/1.txt
|
||||
# HUD
|
||||
assets-cg/hud_wave.png
|
||||
assets-cg/hud_wave2.png
|
||||
assets-cg/skillicons.png
|
||||
# Player animations
|
||||
assets-cg/player/player_idle_up.png
|
||||
assets-cg/player/player_idle_right.png
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 322 B |
Binary file not shown.
After Width: | Height: | Size: 315 B |
|
@ -5,9 +5,8 @@ __ R_ Rs R_ R_ #_ __ #_ Y_ Y_ Y_ #_ #b #t #_ __ __ __ #b #_ #_ __ __ __
|
|||
__ R_ R_ R_ R_ R_ __ Y_ Y_ Y_ Y_ Y_ Y_ Y_ Y_ #_ #_ #_ G_ G_ G_ __ __ __
|
||||
__ R_ R_ R_ R_ Y_ #_ Y_ Y_ Y_ Y_ Y_ Y_ Y_ Y_ Y_ Y_ Y_ G_ G_ G_ __ __ __
|
||||
__ R_ Y_ Y_ Y_ Y_ Y_ Y_ __ __ Y_ Y_ Y_ Y_ Y_ Y_ Y_ Y_ Y_ Y_ __ __ __ __
|
||||
__ Y_ Y_ Y_ Y_ Y_ Y_ Y_ #t #_ Y_ Y_ Y_ Y_ Y_ Y_ __ Y_ Y_ Y_ #_ __ __ __
|
||||
__ __ __ __ __ __ Y_ Y_ Y_ Y_ Y_ Y_ Y_ Y_ Y_ Y_ __ Y_ Y_ Y_ Y_ #b #_ __
|
||||
__ __ #_ #t #_ #_ Y_ Y_ Y_ Y_ __ __ Y_ Y_ Y_ Y_ __ Y_ Y_ Y_ Y_ Y_ Y_ __
|
||||
__ __ __ __ __ __ Y_ Y_ #t #_ Y_ Y_ Y_ Y_ Y_ Y_ __ Y_ Y_ Y_ #_ __ __ __
|
||||
__ __ #_ #t #_ #_ Y_ Y_ Y_ Y_ Y_ Y_ Y_ Y_ Y_ Y_ __ Y_ Y_ Y_ Y_ #b #_ __
|
||||
__ __ G_ G_ G_ Y_ Y_ Y_ Y_ __ __ __ Y_ #_ #b #_ #_ Y_ B_ B_ B_ B_ Y_ __
|
||||
__ __ G_ G_ G_ __ Y_ Y_ Y_ __ __ __ Y_ Y_ Y_ B_ B_ B_ B_ Bs B_ B_ B_ __
|
||||
__ __ G_ G_ G_ __ __ Y_ Y_ __ __ __ __ __ __ __ __ B_ B_ B_ B_ B_ __ __
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 638 B |
36
src/render.c
36
src/render.c
|
@ -28,6 +28,9 @@ void camera_init(camera_t *c, map_t const *m)
|
|||
|
||||
c->x = (c->limits.x_min + c->limits.x_max) / 2;
|
||||
c->y = (c->limits.y_min + c->limits.y_max) / 2;
|
||||
|
||||
/* Slightly off-center to add space for the HUD */
|
||||
c->y -= fix(0.5);
|
||||
}
|
||||
|
||||
ipoint_t camera_map2screen(camera_t const *c, fpoint_t p)
|
||||
|
@ -214,6 +217,13 @@ void render_game(game_t const *g, bool show_hitboxes)
|
|||
for(int i = 0; i < g->entity_count; i++)
|
||||
enemies_left += (g->entities[i]->identity != 0);
|
||||
|
||||
extern bopti_image_t img_hud_wave, img_hud_wave2;
|
||||
dimage((DWIDTH-img_hud_wave.width) / 2, 17, &img_hud_wave);
|
||||
dsubimage((DWIDTH-img_hud_wave2.width) / 2, 17, &img_hud_wave2,
|
||||
0, 0, (img_hud_wave2.width*enemies_left) /
|
||||
g->level->waves[g->wave-1].enemy_count, img_hud_wave2.height,
|
||||
DIMAGE_NONE);
|
||||
|
||||
if(enemies_left > 0)
|
||||
dprint_opt(DWIDTH / 2, 2, C_WHITE, C_NONE, DTEXT_CENTER, DTEXT_TOP,
|
||||
"Wave %d: %d/%d enemies left", g->wave, enemies_left,
|
||||
|
@ -230,6 +240,32 @@ void render_game(game_t const *g, bool show_hitboxes)
|
|||
dprint_opt(DWIDTH - 2, 2, C_WHITE, C_NONE, DTEXT_RIGHT, DTEXT_TOP,
|
||||
"ATK:%d DEF:%d", player->ATK, player->DEF);
|
||||
|
||||
/* Render skill icons */
|
||||
extern bopti_image_t img_skillicons;
|
||||
for(int i = 0; i < 6; i++) {
|
||||
/* Activity and cooldown */
|
||||
fixed_t cooldown_total=0, cooldown_remaining=0;
|
||||
if(i == 0 && player->movement.dash < 0) {
|
||||
cooldown_total = player->movement_params->dash_cooldown;
|
||||
cooldown_remaining = -player->movement.dash;
|
||||
}
|
||||
|
||||
int x=15+68*i, y=DHEIGHT-28, bg=(cooldown_remaining!=0);
|
||||
dsubimage(x, y, &img_skillicons, 23*bg, 0, 23, 23, DIMAGE_NONE);
|
||||
dsubimage(x, y, &img_skillicons, 23*(i+2), 0, 23, 23, DIMAGE_NONE);
|
||||
|
||||
/* Darken the area representing remaining cooldown */
|
||||
if(cooldown_total != 0) {
|
||||
int height = (cooldown_remaining * 23) / cooldown_total;
|
||||
for(int y1 = y+23-height; y1 < y + 23; y1++) {
|
||||
for(int x1 = x; x1 < x+23; x1++) {
|
||||
int i = DWIDTH * y1 + x1;
|
||||
gint_vram[i] = ~((~gint_vram[i] & 0xf7de) >> 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dfont(old_font);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue