diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/common.h | 8 | ||||
-rw-r--r-- | include/entities.h | 51 | ||||
-rw-r--r-- | include/ui.h | 1 | ||||
-rw-r--r-- | include/world.h | 9 |
4 files changed, 64 insertions, 5 deletions
diff --git a/include/common.h b/include/common.h index 095b3e3..31126d7 100644 --- a/include/common.h +++ b/include/common.h @@ -54,11 +54,17 @@ typedef struct { vec2 end; } Ray; +typedef struct{ + float red; + float green; + float blue; +} Color; + /** * Define the game's name (displayed in the window title). */ -#define GAME_NAME "Independent Study v.0.4 alpha" +#define GAME_NAME "Independent Study v.0.5 alpha - NOW WITH SOUND!" /** * The desired width of the game window. diff --git a/include/entities.h b/include/entities.h index dd3adab..1abe886 100644 --- a/include/entities.h +++ b/include/entities.h @@ -31,7 +31,52 @@ enum GENDER{ enum MOB_SUB { MS_RABBIT = 1, MS_BIRD, - MS_TRIGGER + MS_TRIGGER, + MS_DOOR +}; + +enum BUILD_SUB{ + TOWN_HALL = 1, + HOUSE, + HOUSE2, + HOUSE3, + HOUSE4, + FOUNTAIN +}; + +class Particles{ +public: + vec2 loc; + float width; + float height; + float velx; + float vely; + Color color; + int duration; + bool canMove; + Particles(float x, float y, float w, float h, float vx, float vy, Color c, int d){ + loc.x = (x); + loc.y = (y); + width = (w); + height = (h); + velx = vx; + vely = vy; + color.red = (c.red); + color.green = (c.green); + color.blue = (c.blue); + duration = d; + } + ~Particles(){} + void draw(){ + glColor3f(color.red,color.green,color.blue); + glRectf(loc.x,loc.y,loc.x+width,loc.y+height); + } + bool kill(float delta){ + duration -= delta; + if(duration <= 0) + return true; + else return false; + } }; class Entity{ @@ -58,6 +103,7 @@ public: bool canMove; // Enables movement bool right,left; // Direction faced by Entity bool alive; + bool hit; unsigned char ground; // Shows how the Entity is grounded (if it is) /* @@ -118,11 +164,12 @@ class Structures : public Entity{ public: void *inWorld; void *inside; + BUILD_SUB bsubtype; Structures(); ~Structures(); - unsigned int spawn(_TYPE, float, float); + unsigned int spawn(_TYPE, BUILD_SUB, float, float); }; class Mob : public Entity{ diff --git a/include/ui.h b/include/ui.h index 2fe3b0a..5d17c47 100644 --- a/include/ui.h +++ b/include/ui.h @@ -87,6 +87,7 @@ namespace ui { void toggleBlack(void); void toggleBlackFast(void); void toggleWhite(void); + void toggleWhiteFast(void); void waitForCover(void); } diff --git a/include/world.h b/include/world.h index 1e78cd0..0a23965 100644 --- a/include/world.h +++ b/include/world.h @@ -164,12 +164,15 @@ public: std::vector<Mob *> mob; std::vector<Entity *> entity; std::vector<Object *> object; + std::vector<Particles *> particles; - void addStructure(_TYPE t,float x,float y,World *outside,World *inside); + void addStructure(_TYPE t,BUILD_SUB sub,float x,float y,World *outside,World *inside); + void addVillage(int bCount, int npcMin, int npcMax,_TYPE t,float x,float y,World *outside,World *inside); void addMob(int t,float x,float y); void addMob(int t,float x,float y,void (*hey)(Mob *)); void addNPC(float x,float y); void addObject(ITEM_ID, bool, const char *, float, float); + void addParticle(float, float, float, float, float, float, Color color, int); void update(Player *p,unsigned int delta); @@ -231,6 +234,9 @@ public: World *goWorldRight(Player *p); World *goWorldBack(Player *p); World *goWorldFront(Player *p); + + bool isWorldLeft(void); + bool isWorldRight(void); /* * Called to enter/exit a structure. @@ -277,7 +283,6 @@ public: class Arena : public World { private: vec2 pxy; - vec2 door; World *exit; public: Arena(World *leave,Player *p); |