Adds juice

- Dust puffs when tiles begin to fall
- Fixed shop prices. 100 gold is a lot of money and it impacts your
    score when buying.
This commit is contained in:
Linus Probert 2019-03-08 13:02:56 +01:00
parent 46fbdc1b3c
commit af0c61684d
6 changed files with 41 additions and 2 deletions

View File

@ -70,6 +70,7 @@
#define C_YELLOW (SDL_Color) { 255, 255, 0, 255 } #define C_YELLOW (SDL_Color) { 255, 255, 0, 255 }
#define C_BLACK (SDL_Color) { 0, 0, 0, 255 } #define C_BLACK (SDL_Color) { 0, 0, 0, 255 }
#define C_PURPLE (SDL_Color) { 137, 16, 229, 255 } #define C_PURPLE (SDL_Color) { 137, 16, 229, 255 }
#define C_GREY (SDL_Color) { 89, 89, 89, 255 }
// MSVC seems to have min/max defined. // MSVC seems to have min/max defined.
// Haven't looked into it further. // Haven't looked into it further.

View File

@ -418,6 +418,9 @@ void map_room_destroy(Room *room)
void void
map_trigger_tile_fall(MapTile *tile) map_trigger_tile_fall(MapTile *tile)
{ {
if (tile->sprite->state != SPRITE_STATE_FALLING && tile->sprite->state != SPRITE_STATE_PLUMMETED)
particle_engine_dust_puff(tile->sprite->pos, tile->sprite->dim);
tile->sprite->state = SPRITE_STATE_FALLING; tile->sprite->state = SPRITE_STATE_FALLING;
tile->lethal = true; tile->lethal = true;
} }

View File

@ -525,7 +525,7 @@ l_create_shop_artifact(lua_State *L)
Artifact *a = artifact_create_random(player, 2); Artifact *a = artifact_create_random(player, 2);
a->sprite->pos = POS(x, y); a->sprite->pos = POS(x, y);
artifact_add_price(a, map->level * 50); artifact_add_price(a, 100);
linkedlist_append(&map->artifacts, a); linkedlist_append(&map->artifacts, a);

View File

@ -691,7 +691,7 @@ monster_drop_loot(Monster *monster, Map *map, Player *player)
} }
if (strcmp(monster->label, "The Trader") == 0) { if (strcmp(monster->label, "The Trader") == 0) {
Item *treasure = item_builder_build_treasure(PLATINUM, 25 * monster->stats.lvl); Item *treasure = item_builder_build_treasure(PLATINUM, 10 * monster->stats.lvl);
treasure->sprite->pos = monsterTilePos; treasure->sprite->pos = monsterTilePos;
linkedlist_append(&map->items, treasure); linkedlist_append(&map->items, treasure);
} }

View File

@ -188,6 +188,38 @@ particle_engine_eldritch_explosion(Position pos, Dimension dim)
create_explosion(pos, dim, 1, C_GREEN); create_explosion(pos, dim, 1, C_GREEN);
} }
void
particle_engine_dust_puff(Position pos, Dimension dim)
{
check_engine();
for (unsigned int i = 0; i < 50; ++i) {
int x, y, xv, yv, w, h;
unsigned int lt;
Particle *p;
x = get_random(dim.width) + pos.x;
y = get_random(dim.height) + pos.y;
xv = get_random(200) - 100;
yv = get_random(200) - 100;
lt = get_random(10) + 10;
w = get_random(3);
h = get_random(3);
p = create_rect_particle();
p->particle.rect.pos = (Position) { x, y };
p->particle.rect.dim = (Dimension) { w, h };
p->velocity = (Vector2d) { (float) xv, (float) yv };
p->movetime = lt;
p->lifetime = lt;
p->color = C_GREY;
p->blend_mode = SDL_BLENDMODE_BLEND;
linkedlist_append(&engine->game_particles, p);
}
}
void void
particle_engine_speed_lines(Position pos, Dimension dim, bool horizontal) particle_engine_speed_lines(Position pos, Dimension dim, bool horizontal)
{ {

View File

@ -37,6 +37,9 @@ particle_engine_fire_explosion(Position, Dimension);
void void
particle_engine_eldritch_explosion(Position, Dimension); particle_engine_eldritch_explosion(Position, Dimension);
void
particle_engine_dust_puff(Position, Dimension);
void void
particle_engine_speed_lines(Position, Dimension, bool horizontal); particle_engine_speed_lines(Position, Dimension, bool horizontal);