Bloodspatter based on damage.
This commit is contained in:
parent
8def916504
commit
08207f5e35
|
@ -184,7 +184,7 @@ initMainMenu(void)
|
||||||
int hcenter;
|
int hcenter;
|
||||||
|
|
||||||
Sprite *s1 = sprite_create();
|
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,
|
texture_load_from_text(s1->textures[0], menu_items[i].label,
|
||||||
C_DEFAULT, gRenderer);
|
C_DEFAULT, gRenderer);
|
||||||
|
|
||||||
|
@ -193,7 +193,7 @@ initMainMenu(void)
|
||||||
s1->fixed = true;
|
s1->fixed = true;
|
||||||
|
|
||||||
Sprite *s2 = sprite_create();
|
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,
|
texture_load_from_text(s2->textures[0], menu_items[i].label,
|
||||||
C_HOVER, gRenderer);
|
C_HOVER, gRenderer);
|
||||||
|
|
||||||
|
@ -209,6 +209,11 @@ resetGame(void)
|
||||||
{
|
{
|
||||||
SDL_FlushEvents(SDL_FIRSTEVENT, SDL_LASTEVENT);
|
SDL_FlushEvents(SDL_FIRSTEVENT, SDL_LASTEVENT);
|
||||||
|
|
||||||
|
if (mainMenu) {
|
||||||
|
menu_destroy(mainMenu);
|
||||||
|
mainMenu = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (gMap)
|
if (gMap)
|
||||||
map_destroy(gMap);
|
map_destroy(gMap);
|
||||||
|
|
||||||
|
|
|
@ -236,7 +236,7 @@ monster_hit(Monster *monster, unsigned int dmg)
|
||||||
p.x += 8;
|
p.x += 8;
|
||||||
p.y += 8;
|
p.y += 8;
|
||||||
Dimension d = { 8, 8 };
|
Dimension d = { 8, 8 };
|
||||||
particle_engine_bloodspray(p, d);
|
particle_engine_bloodspray(p, d, dmg);
|
||||||
} else {
|
} else {
|
||||||
monster->missText->active = true;
|
monster->missText->active = true;
|
||||||
monster->hitText->active = false;
|
monster->hitText->active = false;
|
||||||
|
|
|
@ -38,12 +38,15 @@ particle_engine_init(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
particle_engine_bloodspray(Position pos, Dimension dim)
|
particle_engine_bloodspray(Position pos, Dimension dim, unsigned int count)
|
||||||
{
|
{
|
||||||
|
|
||||||
check_engine();
|
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;
|
int x, y, xv, yv, w, h;
|
||||||
unsigned int mt, lt;
|
unsigned int mt, lt;
|
||||||
Particle *p;
|
Particle *p;
|
||||||
|
|
|
@ -10,7 +10,7 @@ void
|
||||||
particle_engine_init(void);
|
particle_engine_init(void);
|
||||||
|
|
||||||
void
|
void
|
||||||
particle_engine_bloodspray(Position, Dimension);
|
particle_engine_bloodspray(Position, Dimension, unsigned int count);
|
||||||
|
|
||||||
void
|
void
|
||||||
particle_engine_update(float deltatime);
|
particle_engine_update(float deltatime);
|
||||||
|
|
|
@ -313,7 +313,7 @@ player_hit(Player *p, unsigned int dmg)
|
||||||
Position pos = p->sprite->pos;
|
Position pos = p->sprite->pos;
|
||||||
pos.x += 8;
|
pos.x += 8;
|
||||||
pos.y += 8;
|
pos.y += 8;
|
||||||
particle_engine_bloodspray(pos, (Dimension) { 8, 8 });
|
particle_engine_bloodspray(pos, (Dimension) { 8, 8 }, dmg);
|
||||||
} else {
|
} else {
|
||||||
p->missText->active = true;
|
p->missText->active = true;
|
||||||
p->hitText->active = false;
|
p->hitText->active = false;
|
||||||
|
|
Loading…
Reference in New Issue