diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/common.h | 6 | ||||
-rw-r--r-- | include/entities.h | 22 |
2 files changed, 17 insertions, 11 deletions
diff --git a/include/common.h b/include/common.h index 922dd59..1210adb 100644 --- a/include/common.h +++ b/include/common.h @@ -11,7 +11,7 @@ #include <SDL2/SDL_opengl.h> typedef struct { float x; float y; } vec2; -enum _TYPE {STRUCTURET = -1, PLAYERT = 0, NPCT = 1}; +enum _TYPE {STRUCTURET = -1, PLAYERT = 0, NPCT = 1}; //these are the main types of entities #include <entities.h> @@ -19,12 +19,12 @@ enum _TYPE {STRUCTURET = -1, PLAYERT = 0, NPCT = 1}; #define SCREEN_HEIGHT 720 //#define FULLSCREEN -#define HLINE 3 +#define HLINE 3 //base unit of the world #define initRand(s) srand(s) #define getRand() rand() -template<typename T, size_t N> +template<typename T, size_t N> //this fuction returns the size of any array int eAmt(T (&)[N]){return N;} //SDL VARIABLES diff --git a/include/entities.h b/include/entities.h index df81ad2..53a8057 100644 --- a/include/entities.h +++ b/include/entities.h @@ -6,25 +6,31 @@ class Entity{ public: void *inWorld; - float width; + float width; //width and height of the player float height; - float speed; + float speed; //speed of the play + //type and subtype int subtype; _TYPE type; - vec2 loc; + //example: + //type 1(NPC) + // |(subtype) + // |-> 0 Base NPC + // |-> 1 Merchant + vec2 loc; //location and velocity of the entity vec2 vel; - bool right,left, canMove; - bool alive; - unsigned char ground; + 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[]; + unsigned int texture[]; //TODO: ADD TEXTURES void spawn(float, float); void draw(void); void wander(int, vec2*); virtual void interact(){} private: - int ticksToUse; + int ticksToUse; //The variable for deciding how long an entity should do a certain task }; class Player : public Entity{ |