blob: 60467ab7cca5553003bd2a9b618be24895771f1b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
#ifndef ENTITY_H
#define ENTITY_H
#include "raylib.h"
#include "raytmx.h"
#include "player.h"
#include "map_manager.h"
typedef struct Enemy {
Vector2 position;
Rectangle bounds;
uint32_t gid;
int health;
bool active;
} Enemy;
typedef struct Static {
Vector2 position;
Rectangle bounds;
uint32_t gid;
bool active;
} Static;
typedef struct Collectible {
Vector2 position;
Rectangle bounds;
uint32_t gid;
bool active;
int tileX;
int tileY;
} Collectible;
typedef struct Movable {
Vector2 position;
Rectangle bounds;
uint32_t gid;
bool active;
} Movable;
typedef struct EntityManager {
Enemy *enemies;
int enemiesCount;
Collectible *collectibles;
int collectiblesCount;
Static *statics;
int staticsCount;
Movable *movables;
int movablesCount;
} EntityManager;
EntityManager InitEntityManager(uint32_t capacity);
void SpawnEntitiesFromMap(EntityManager *mgr, TmxMap *map);
void UpdateEntities(EntityManager *mgr, Player *player, MapManager *mapMgr);
void DrawEntities(EntityManager *mgr, TmxMap *map);
void UnloadEntityManager(EntityManager *mgr);
#endif // ENTITY_H
|