forked from Massena/zkwul
35 lines
1009 B
C
35 lines
1009 B
C
#pragma once
|
|
|
|
#define LEVEL_SIZE 16
|
|
#define TILE_SIZE 12
|
|
|
|
/* see we use a typedef like bellow
|
|
* its lazy and allow you to type
|
|
* Vec2 instead of struct TwoValues */
|
|
typedef struct Vec2 {
|
|
int x, y;
|
|
} Vec2;
|
|
|
|
/* we do da same with player cause laziness never killed nobody
|
|
* wait */
|
|
typedef struct Player {
|
|
Vec2 pos;
|
|
Vec2 spawn;
|
|
} Player;
|
|
|
|
/* using a typedef is what cool kids do at least i think
|
|
* you might no remember what `int x` is :(
|
|
* if x is declared with `tile_t x` you know x is some tile :)
|
|
* knowledge is power and cool
|
|
* as bonus it looks cool in function declaration
|
|
* cool stuff told u :D */
|
|
typedef int tile_t;
|
|
|
|
Vec2 search(tile_t x, tile_t level[16][16]);
|
|
/* here u can see i replaced x and y arguments with your twovalues struct
|
|
* u made smthing use it
|
|
* it will be handy in the future and makes better looking code */
|
|
int collide_pixel(Vec2 pos, tile_t obj, tile_t level[16][16]);
|
|
int collide(Vec2 pos, int h, tile_t obj, tile_t level[16][16]);
|
|
Player level_reset(Player player);
|