/
entity.h
48 lines (45 loc) · 1.2 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
typedef enum Animations
{
Animations_default,
Animations_stand,
Animations_run,
Animations_jump,
Animations_fall,
Animations_slide
} Animations;
typedef enum EntityType
{
EntityType_spike,
EntityType_smallSpike,
EntityType_block,
EntityType_save,
EntityType_warp,
EntityType_particle,
EntityType_playerBullet,
EntityType_fruit,
EntityType_movingPlatform,
EntityType_boss,
EntityType_vine,
EntityType_jumpRefresher,
} EntityType;
typedef struct Entity
{
Vector2f position, velocity, acceleration;
Sprite sprite;
EntityType type;
bool active;
float spin, spinFriction, friction;
float animationTimer;
float depth;
Controller* controller;
Controller controllerData;
} Entity;
Entity* getFirstFreeEntity(Iwbtg* iw);
int entityCount(Iwbtg* iw, EntityType type);
Entity* createEntity(Iwbtg* iw, EntityType type, float x, float y);
Entity* createEntityFromTypeIndex(Iwbtg* iw, int typeIndex, int x, int y);
void destroyEntity(Entity* e);
void destroyAllEntities(Iwbtg* iw);
void entityUpdate(Entity* e, Iwbtg* iw, float dt);
bool checkAdjacentBlock(Iwbtg* iw, Entity* e, int x, int y);
void entityDraw(Entity* e, Iwbtg* iw);