diff --git a/CMakeLists.txt b/CMakeLists.txt index 4223005..8d4554f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,6 +31,7 @@ set(LEVELS lvl/3.kble lvl/4.kble lvl/5.kble + lvl/6.kble ) set(ASSETS diff --git a/inc/tile.h b/inc/tile.h index 0eda727..0c273e3 100644 --- a/inc/tile.h +++ b/inc/tile.h @@ -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, }; diff --git a/lvl/6.kble b/lvl/6.kble new file mode 100644 index 0000000..a0c4655 Binary files /dev/null and b/lvl/6.kble differ diff --git a/res/tileset.png b/res/tileset.png index 8813be1..c99215b 100644 Binary files a/res/tileset.png and b/res/tileset.png differ diff --git a/src/level.c b/src/level.c index f46d0ca..8c0bbb9 100644 --- a/src/level.c +++ b/src/level.c @@ -9,9 +9,9 @@ #include 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) diff --git a/src/shatter.c b/src/shatter.c index bdf6578..a870c3b 100644 --- a/src/shatter.c +++ b/src/shatter.c @@ -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); }