38 lines
855 B
C
38 lines
855 B
C
#pragma once
|
|
#include "player.h"
|
|
#include "exit.h"
|
|
#include "deathpart.h"
|
|
#include <stdbool.h>
|
|
|
|
struct Game;
|
|
|
|
enum { ET_NONE = 0 };
|
|
|
|
typedef struct Entity Entity;
|
|
struct Entity {
|
|
unsigned long uuid;
|
|
void (*update)(Entity *this, struct Game *g);
|
|
void (*draw)(Entity *this, struct Game *g);
|
|
unsigned int type;
|
|
int id;
|
|
int pos[2];
|
|
double vel[2];
|
|
double rem[2];
|
|
int width;
|
|
int height;
|
|
bool ignore_solids;
|
|
bool bonk_ceiling;
|
|
union {
|
|
Player player;
|
|
Exit exit;
|
|
DeathPart deathpart;
|
|
};
|
|
};
|
|
|
|
unsigned int entity_type(const char *type);
|
|
bool entity_collide(Entity *this, struct Game *g, int ox, int oy);
|
|
bool entity_meet(Entity *this, Entity *other);
|
|
Entity *entity_place_meeting(Entity *this, struct Game *g, unsigned int type);
|
|
void entity_move(Entity *this, struct Game *g);
|
|
Entity *entity_init(Entity *this, unsigned int type, int x, int y);
|