-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEntity.h
52 lines (39 loc) · 1.06 KB
/
Entity.h
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
#ifndef ENTITY_H
#define ENTITY_H
#include <stdlib.h>
#include "Tilemap.h"
#include "Coordinate.h"
typedef enum Direction_E
{
NORTH,
SOUTH,
WEST,
EAST
} Direction_e;
typedef enum EntityType_E{PLAYER, MOB} EntityType_e;
typedef struct Entity_S
{
EntityType_e m_type;
double m_last_move;
// Entity hp
short int m_health;
// Entity coordinates
Coordinate_s m_position;
// Entity direction
Direction_e m_direction;
struct Tilemap_s *m_tilemap;
Coordinate_s m_chunk_position;
} Entity_s;
typedef struct Entitieslist_S
{
Entity_s *m_entity;
struct Entitieslist_S *m_next;
} Entitieslist_s;
Entity_s *CreateEntity(EntityType_e type);
Block_s **getFrontBlock(Entity_s *entity, struct Tilemap_S *tilemap);
struct TilemapBlock_S *getFrontTilemapBlock(Entity_s *entity, struct Tilemap_S *tilemap);
void addEntityToList(Entitieslist_s **list, Entity_s *entity);
// Return the entity chunk position
Coordinate_s getEntityChunkCoordinate(Entity_s *entity);
void moveEntityInDirection(Entity_s *entity);
#endif /* !ENTITY_H */