diff options
author | drumsetmonkey <abelleisle@roadrunner.com> | 2015-12-14 08:25:15 -0500 |
---|---|---|
committer | drumsetmonkey <abelleisle@roadrunner.com> | 2015-12-14 08:25:15 -0500 |
commit | c5050b17d16670c6151d5c135c3b01d66b7530f9 (patch) | |
tree | d8cffed7b2a576023e013b2133504d273e85b652 /include | |
parent | b477db406b9d7aa4f62a750c9ae3c3cedc533b3b (diff) |
Added particles
Diffstat (limited to 'include')
-rw-r--r-- | include/entities.h | 36 | ||||
-rw-r--r-- | include/world.h | 5 |
2 files changed, 35 insertions, 6 deletions
diff --git a/include/entities.h b/include/entities.h index e0c0887..dbaf9f5 100644 --- a/include/entities.h +++ b/include/entities.h @@ -34,22 +34,48 @@ enum MOB_SUB { MS_TRIGGER }; -struct Particles{ +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; - Particles(float x, float y, float w, float h, Color c){ + 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(){ - std::cout << "Drawing Particles\n"; + 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; } }; @@ -77,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) /* @@ -137,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/world.h b/include/world.h index 5a16277..dbaaf2c 100644 --- a/include/world.h +++ b/include/world.h @@ -161,12 +161,13 @@ public: 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 x, float y, float w, float h, Color color); + void addParticle(float, float, float, float, float, float, Color color, int); void update(Player *p,unsigned int delta); |