mirror of https://git.sr.ht/~kikoodx/crystal-tower
game starts
This commit is contained in:
parent
32c5a0c13b
commit
07703bbb76
3
Makefile
3
Makefile
|
@ -6,6 +6,9 @@ ray: clean format out/levels_bin.h
|
|||
cmake -B build .
|
||||
make -C build
|
||||
|
||||
run: ray
|
||||
build/target
|
||||
|
||||
out/levels_bin.h:
|
||||
mkdir -p out
|
||||
cembed -o out/levels_bin.h lvl/*.kble
|
||||
|
|
13
inc/level.h
13
inc/level.h
|
@ -1,20 +1,21 @@
|
|||
#pragma once
|
||||
#include "tile.h"
|
||||
#include "vec.h"
|
||||
#include <stdint.h>
|
||||
|
||||
struct LevelBin {
|
||||
unsigned char format;
|
||||
unsigned char chunk_size;
|
||||
unsigned short width;
|
||||
unsigned short height;
|
||||
unsigned char data[];
|
||||
uint8_t format;
|
||||
uint8_t chunk_size;
|
||||
uint16_t width;
|
||||
uint16_t height;
|
||||
uint8_t data[];
|
||||
} __attribute__((__packed__));
|
||||
|
||||
struct Level {
|
||||
int width;
|
||||
int height;
|
||||
int size;
|
||||
char *data;
|
||||
uint8_t *data;
|
||||
int id;
|
||||
};
|
||||
|
||||
|
|
2
raygint
2
raygint
|
@ -1 +1 @@
|
|||
Subproject commit 04cfbeac77bbe097d94566c4c3f345336318aca5
|
||||
Subproject commit edc6fb1c5bc52a3b4f7c735980576cf44543b4de
|
|
@ -13,7 +13,7 @@ anim_new(bopti_image_t *texture, int x, int y, int frame_width,
|
|||
anim.pos = VEC(x, y);
|
||||
#ifdef GINT
|
||||
anim.frame_dim = VEC(frame_width, texture->height);
|
||||
anim.life_ini = frame_duration * texture->width * frame_width;
|
||||
anim.life_ini = frame_duration * texture->width / frame_width;
|
||||
#endif
|
||||
#ifdef RAYLIB
|
||||
anim.frame_dim = VEC(frame_width, frame_width);
|
||||
|
|
|
@ -20,6 +20,9 @@ level_load(int id)
|
|||
{
|
||||
extern int end;
|
||||
const struct LevelBin *s = levels[id];
|
||||
#ifdef RAYLIB
|
||||
s++;
|
||||
#endif
|
||||
int i = s->width * s->height;
|
||||
self.width = s->width;
|
||||
self.height = s->height;
|
||||
|
|
|
@ -22,7 +22,6 @@ shatter(int x, int y)
|
|||
const int ax = (int)(x / TILE_SIZE) * TILE_SIZE;
|
||||
const int ay = (int)(y / TILE_SIZE) * TILE_SIZE;
|
||||
struct Anim p = anim_new(&bimg_shatter, ax, ay, TILE_SIZE, 2, false);
|
||||
|
||||
p.callback = callback;
|
||||
if (level_get_px(ax, ay) == TILE_SOLID && !particles_here(ax, ay))
|
||||
particles_add(p);
|
||||
|
|
Loading…
Reference in New Issue