start of first level, tentative spawner

This commit is contained in:
Lephenixnoir 2021-06-15 17:59:23 +02:00
parent c1e3fb34b4
commit 4e16553124
Signed by: Lephenixnoir
GPG Key ID: 1BBA026E13FC0495
6 changed files with 35 additions and 6 deletions

View File

@ -28,9 +28,12 @@ set(SOURCES
src/util.c
)
set(ASSETS
# Tilesets
assets-cg/tileset_base.png
assets-cg/tileset_decor.png
# Levels
assets-cg/levels/demo.txt
assets-cg/levels/1.txt
# Player animations
assets-cg/player/player_idle_up.png
assets-cg/player/player_idle_right.png

23
assets-cg/levels/1.txt Normal file
View File

@ -0,0 +1,23 @@
[level]
__ #_ #b #_ #_ __ __ __ #_ #t #_ __ __ __ __ __ __ __ __ __ __ __ __ __
__ R_ Rs R_ R_ #_ __ #_ Y_ Y_ Y_ #_ #b #t #_ __ __ __ #b #_ #_ __ __ __
__ R_ R_ R_ R_ R_ __ Y_ Y_ Y_ Y_ Y_ Y_ Y_ Y_ #_ #_ #_ G_ G_ G_ __ __ __
__ R_ R_ R_ R_ Y_ #_ Y_ Y_ Y_ Y_ Y_ Y_ Y_ Y_ Y_ Y_ Y_ G_ G_ G_ __ __ __
__ R_ Y_ Y_ Y_ Y_ Y_ Y_ __ __ Y_ Y_ Y_ Y_ Y_ Y_ Y_ Y_ Y_ Y_ __ __ __ __
__ Y_ Y_ Y_ Y_ Y_ Y_ Y_ #t #_ Y_ Y_ Y_ Y_ Y_ Y_ __ Y_ Y_ Y_ #_ __ __ __
__ __ __ __ __ __ Y_ Y_ Y_ Y_ Y_ Y_ Y_ Y_ Y_ Y_ __ Y_ Y_ Y_ Y_ #b #_ __
__ __ #_ #t #_ #_ Y_ Y_ Y_ Y_ __ __ Y_ Y_ Y_ Y_ __ Y_ Y_ Y_ Y_ Y_ Y_ __
__ __ G_ G_ G_ Y_ Y_ Y_ Y_ __ __ __ Y_ #_ #b #_ #_ Y_ B_ B_ B_ B_ Y_ __
__ __ G_ G_ G_ __ Y_ Y_ Y_ __ __ __ Y_ Y_ Y_ B_ B_ B_ B_ Bs B_ B_ B_ __
__ __ G_ G_ G_ __ __ Y_ Y_ __ __ __ __ __ __ __ __ B_ B_ B_ B_ B_ __ __
__ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __
[base]
_ Y R G B
#
[decor]
_ b t s

View File

@ -22,4 +22,4 @@ _ Y R G B
[decor]
_ b t r
_ b t s

Binary file not shown.

Before

Width:  |  Height:  |  Size: 531 B

After

Width:  |  Height:  |  Size: 713 B

View File

@ -21,3 +21,7 @@ typedef struct {
} tiles[];
} level_t;
/* List of levels */
extern level_t lv_demo;
extern level_t lv_1;

View File

@ -20,8 +20,6 @@
#include <libprof.h>
#include <stdlib.h>
extern level_t lv_demo;
int OVERLAY_HITBOXES = 0;
int main(void)
@ -42,7 +40,7 @@ int main(void)
map_t *m = &game.map;
camera_t *c = &game.camera;
game_load(&game, &lv_demo);
game_load(&game, &lv_1);
fpoint_t *path = NULL;
int path_length = 0;
@ -380,8 +378,9 @@ int main(void)
e->color = C_RED;
/* Knockback */
e->movement.vx += fmul(dir.x, KNOCKBACK_SPEED);
e->movement.vy += fmul(dir.y, KNOCKBACK_SPEED);
fixed_t r = (rand() & (fix(1)/4-1)) + fix(7)/8;
e->movement.vx += fmul(dir.x, fmul(r, KNOCKBACK_SPEED));
e->movement.vy += fmul(dir.y, fmul(r, KNOCKBACK_SPEED));
}
}