aboutsummaryrefslogtreecommitdiffstats
path: root/include/entities.h
blob: 9e0257ff16c9ffd71897f14b6825d9741615f6d8 (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
#ifndef ENTITIES_H
#define ENTITIES_H

#include <common.h>

#define NPCp(n) ((NPC *)n)

class Entity{
public:
	void *inWorld;
	float width;	//width and height of the player
	float height;
	float speed;	//speed of the play
	//type and subtype
	int subtype;
	_TYPE type;
			//example:
			//type 	1(NPC)
			//		|(subtype)
			//		|->  0 Base NPC
			//		|->  1 Merchant
	vec2 loc; //location and velocity of the entity
	vec2 vel;
	bool right,left, canMove; //movement variables
	bool alive;				  //the flag for whether or not the entity is alive
	unsigned char ground;	  //variable for testing what ground the entity is on to apply certain traits

	unsigned int texture[];	  //TODO: ADD TEXTURES
	
	void spawn(float, float);
	void draw(void);
	void wander(int, vec2*);
	virtual void interact(){}
private:
	int ticksToUse;	//The variable for deciding how long an entity should do a certain task
};

class Player : public Entity{
public:
	Player();
	void interact();
};

class NPC : public Entity{
private:
	std::vector<int (*)(NPC *)>aiFunc;
public:
	NPC();
	void addAIFunc(int (*func)(NPC *));
	void interact();
};
class Structures : public Entity{
public:
	void *inside;
	Structures();
	unsigned int spawn(_TYPE, float, float);
};

#endif // ENTITIES_H