pointless (lol) spikes

This commit is contained in:
KikooDX 2021-11-12 15:42:07 +01:00
parent bf1820bee2
commit 606fc1e8fb
6 changed files with 18 additions and 3 deletions

View File

@ -31,6 +31,7 @@ set(LEVELS
lvl/3.kble
lvl/4.kble
lvl/5.kble
lvl/6.kble
)
set(ASSETS

View File

@ -6,5 +6,9 @@ enum Tile {
TILE_PLAYER,
TILE_SHATTERED,
TILE_OOB,
TILE_SPIKE_U,
TILE_SPIKE_D,
TILE_SPIKE_R,
TILE_SPIKE_L,
TILE_NEXT,
};

BIN
lvl/6.kble Normal file

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View File

@ -9,9 +9,9 @@
#include <stdlib.h>
static struct Level self;
extern struct LevelBin lvl_0, lvl_1, lvl_2, lvl_3, lvl_4, lvl_5;
extern struct LevelBin lvl_0, lvl_1, lvl_2, lvl_3, lvl_4, lvl_5, lvl_6;
static const struct LevelBin *levels[] = {&lvl_0, &lvl_1, &lvl_2, &lvl_3,
&lvl_4, &lvl_5, NULL};
&lvl_4, &lvl_5, &lvl_6, NULL};
void
level_load(int id)

View File

@ -24,5 +24,15 @@ shatter(int x, int y)
static void
callback(struct Anim *a)
{
level_set_px(a->pos.x, a->pos.y, TILE_SHATTERED);
const int x = a->pos.x / TILE_SIZE;
const int y = a->pos.y / TILE_SIZE;
level_set(x, y, TILE_SHATTERED);
if (level_get(x - 1, y) == TILE_SPIKE_L)
level_set(x - 1, y, TILE_VOID);
if (level_get(x + 1, y) == TILE_SPIKE_R)
level_set(x + 1, y, TILE_VOID);
if (level_get(x, y - 1) == TILE_SPIKE_U)
level_set(x, y - 1, TILE_VOID);
if (level_get(x, y + 1) == TILE_SPIKE_D)
level_set(x, y + 1, TILE_VOID);
}