diff --git a/CMakeLists.txt b/CMakeLists.txt index 3827616..5086ac1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,6 +25,7 @@ set(SOURCES set(LEVELS lvl/0.kble + lvl/1.kble lvl/2.kble ) diff --git a/lvl/1.kble b/lvl/1.kble new file mode 100644 index 0000000..ea898b4 Binary files /dev/null and b/lvl/1.kble differ diff --git a/sle.sh b/sle.sh new file mode 100755 index 0000000..0574047 --- /dev/null +++ b/sle.sh @@ -0,0 +1,6 @@ +#!/bin/sh +# https://sr.ht/~kikoodx/sle +sle -tile-width 16 -tile-height 16 -level-width 25 -level-height 14 \ +-editor-width 396 -editor-height 224 -editor-off-x -2 -editor-off-y 0 \ +-editor-bg-color '#000000' -picker-bg-color '#000005' \ +-tileset res/tileset.png $@ diff --git a/src/level.c b/src/level.c index c88e585..86922f3 100644 --- a/src/level.c +++ b/src/level.c @@ -10,8 +10,9 @@ static struct Level self; extern struct LevelBin lvl_0; +extern struct LevelBin lvl_1; extern struct LevelBin lvl_2; -static const struct LevelBin *levels[] = {&lvl_0, &lvl_2, NULL}; +static const struct LevelBin *levels[] = {&lvl_0, &lvl_1, &lvl_2, NULL}; void level_load(int id) @@ -22,7 +23,7 @@ level_load(int id) self.height = s->height; self.size = i; self.data = malloc(i); - self.id = 0; + self.id = id; while (i-- > 0) self.data[i] = s->data[i]; player_init(level_find(TILE_PLAYER)); @@ -38,7 +39,7 @@ level_reload(void) void level_next(void) { - if (levels[self.id + 1]) + if (levels[self.id + 1] != NULL) level_load(self.id + 1); else level_reload();