mirror of https://git.sr.ht/~kikoodx/crystal-tower
level disaïgne & bugfix
This commit is contained in:
parent
44a944c00c
commit
1beb63ad41
|
@ -25,6 +25,7 @@ set(SOURCES
|
|||
|
||||
set(LEVELS
|
||||
lvl/0.kble
|
||||
lvl/1.kble
|
||||
lvl/2.kble
|
||||
)
|
||||
|
||||
|
|
Binary file not shown.
|
@ -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 $@
|
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue