burn polarity & heady heading

This commit is contained in:
KikooDX 2021-12-19 18:13:43 +01:00
parent 3dbdf0bf2e
commit 37c358c286
6 changed files with 18 additions and 3 deletions

View File

@ -30,6 +30,7 @@ set(ASSETS
res/shake.kble
res/tilt.kble
res/cave.kble
res/headtrauma.kble
res/fonts/dina.png
)

View File

@ -14,6 +14,8 @@ enum Tile {
TILE_GRAV_R,
TILE_GRAV_L,
TILE_WATER,
TILE_BURN_RED,
TILE_BURN_BLUE,
TILE_COUNT,
TILE_OOB,
};

BIN
res/headtrauma.kble Normal file

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View File

@ -12,10 +12,11 @@ static struct Level level;
extern bopti_image_t bimg_tileset;
extern struct LevelBin kble_test, kble_burn, kble_bounce, kble_worm, kble_shake,
kble_tilt, kble_cave;
kble_tilt, kble_cave, kble_headtrauma;
static const struct LevelBinNamed levels[] = {
{&kble_test, "gentle introduction"},
{&kble_cave, "light at the end of the tunnel"},
{&kble_cave, "the light at the end of the tunnel"},
{&kble_headtrauma, "minefield"},
{&kble_burn, "these are rare"},
{&kble_bounce, "deceptive road"},
{&kble_shake, "breaking into reality"},
@ -92,9 +93,11 @@ level_regen_visual_data(int editing)
if (editing) continue;
switch (tile) {
case TILE_RED:
case TILE_BURN_RED:
vd->img_y += polarity() ? TILE_SIZE : 0;
break;
case TILE_BLUE:
case TILE_BURN_BLUE:
vd->img_y += polarity() ? 0 : TILE_SIZE;
break;
default:

View File

@ -12,6 +12,7 @@ static struct Vec update_rem(struct Player *);
static int collide_margin(int x, int y, int tile, int margin);
static int collide(int x, int y, int tile);
static int collide_solid(int x, int y);
static int collide_burn(int x, int y);
void
player_spawn(struct Player *p)
@ -116,7 +117,7 @@ player_update(struct Player *p)
}
/* burn and death */
if (collide(p->pos.x, p->pos.y, TILE_BURN)) {
if (collide_burn(p->pos.x, p->pos.y)) {
if (++p->burn >= BURN_DEATH) {
level_reload();
return;
@ -241,3 +242,11 @@ collide_solid(int x, int y)
(!polarity() && collide(x, y, TILE_RED)) ||
(polarity() && collide(x, y, TILE_BLUE));
}
static int
collide_burn(int x, int y)
{
return collide(x, y, TILE_BURN) ||
(!polarity() && collide(x, y, TILE_BURN_RED)) ||
(polarity() && collide(x, y, TILE_BURN_BLUE));
}