Bloodspatter based on damage.

This commit is contained in:
Linus_Probert 2018-02-09 13:55:57 +01:00
parent 8def916504
commit 08207f5e35
5 changed files with 15 additions and 7 deletions

View File

@ -184,7 +184,7 @@ initMainMenu(void)
int hcenter;
Sprite *s1 = sprite_create();
sprite_load_text_texture(s1, "assets/GUI/SDS_8x8.ttf", 0, 20);
sprite_load_text_texture(s1, "assets/GUI/SDS_8x8.ttf", 0, 25);
texture_load_from_text(s1->textures[0], menu_items[i].label,
C_DEFAULT, gRenderer);
@ -193,7 +193,7 @@ initMainMenu(void)
s1->fixed = true;
Sprite *s2 = sprite_create();
sprite_load_text_texture(s2, "assets/GUI/SDS_8x8.ttf", 0, 20);
sprite_load_text_texture(s2, "assets/GUI/SDS_8x8.ttf", 0, 25);
texture_load_from_text(s2->textures[0], menu_items[i].label,
C_HOVER, gRenderer);
@ -209,6 +209,11 @@ resetGame(void)
{
SDL_FlushEvents(SDL_FIRSTEVENT, SDL_LASTEVENT);
if (mainMenu) {
menu_destroy(mainMenu);
mainMenu = NULL;
}
if (gMap)
map_destroy(gMap);

View File

@ -236,7 +236,7 @@ monster_hit(Monster *monster, unsigned int dmg)
p.x += 8;
p.y += 8;
Dimension d = { 8, 8 };
particle_engine_bloodspray(p, d);
particle_engine_bloodspray(p, d, dmg);
} else {
monster->missText->active = true;
monster->hitText->active = false;

View File

@ -38,12 +38,15 @@ particle_engine_init(void)
}
void
particle_engine_bloodspray(Position pos, Dimension dim)
particle_engine_bloodspray(Position pos, Dimension dim, unsigned int count)
{
check_engine();
for (unsigned int i = 0; i < 15; ++i) {
if (count > 100)
count = 100;
for (unsigned int i = 0; i < count; ++i) {
int x, y, xv, yv, w, h;
unsigned int mt, lt;
Particle *p;

View File

@ -10,7 +10,7 @@ void
particle_engine_init(void);
void
particle_engine_bloodspray(Position, Dimension);
particle_engine_bloodspray(Position, Dimension, unsigned int count);
void
particle_engine_update(float deltatime);

View File

@ -313,7 +313,7 @@ player_hit(Player *p, unsigned int dmg)
Position pos = p->sprite->pos;
pos.x += 8;
pos.y += 8;
particle_engine_bloodspray(pos, (Dimension) { 8, 8 });
particle_engine_bloodspray(pos, (Dimension) { 8, 8 }, dmg);
} else {
p->missText->active = true;
p->hitText->active = false;