hyperultra/src/entity.h

43 lines
814 B
C

#pragma once
#include "player.h"
#include "exit.h"
#include "deathpart.h"
#include "spike.h"
#include <stdbool.h>
struct Game;
enum {
ET_NONE,
ET_player,
ET_exit,
ET_deathpart,
ET_spike,
};
typedef struct Entity Entity;
struct Entity {
unsigned long uuid;
Entity *(*update)(Entity *this, struct Game *g);
Entity *(*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;
};
};
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);