flame = false;
}
- void makeFlame(void){
+ void follow(Entity *f)
+ {
+ following = f;
+ belongsTo = true;
+ }
+
+ void makeFlame(void)
+ {
flame = true;
}
+
+ void createFromXML(XMLElement *e);
+ };
+
+ /**
+ * The particle class, handles a single particle.
+ */
+ class Particles{
+ public:
+ // the location of the particle
+ vec2 loc;
+ float zOffset;
+
+ // the width of the particle, in pixels
+ float width;
+
+ // the height of the particle, in pixels
+ float height;
+
+ // the velocity of the particle, in pixels
+ vec2 vel;
+
+ // the color of the particle
+ Color color;
+
+ // TODO
+ vec2 index;
+
+ // the amount of milliseconds left for the particle to live
+ float duration;
+
+ // when true, the particle will move
+ bool canMove;
+
+ // TODO
+ bool fountain;
+
+ // when true, the particle will be affected by gravity
+ bool gravity;
+
+ // when true, draws the particle behind structures
+ bool behind;
+
+ // when true, the particle will bounce on impact with ground
+ bool bounce;
+
+ Structures *stu;
+
+ Particles(void){}
+
+ // creates a particle with the desired characteristics
+ Particles(float x, float y, float w, float h, float vx, float vy, Color c, float d);
+
+ // allows the particle to be destroyed
+ ~Particles(void){}
+
+ // draws the particle
+ void draw(GLfloat*& p) const;
+
+ // updates a particle
+ void update(float _gravity, float ground_y);
+
+ // returns true if the particle should be killed
+ bool timeUp(void);
};
#include <mob.hpp>
bool Cat::bindTex(void)
{
- glActiveTexture(GL_TEXTURE0);
+ glActiveTexture(GL_TEXTURE0);
tex(0);
- return true;
+ return true;
}
- void Cat::createFromXML(const XMLElement *e)
+ void Cat::createFromXML(XMLElement *e, World *w=nullptr)
{
+ (void)w;
float Xlocx;
if (e->QueryFloatAttribute("x", &Xlocx) == XML_NO_ERROR)
loc.x = Xlocx;
if (debug)
posFlag ^= true;
else {
- currentWorld->addStructure(FIRE_PIT, player->loc.x, player->loc.y, "", "");
+ auto s = new Structures();
+ s->spawn(FIRE_PIT, player->loc.x, player->loc.y);
+ currentWorld->addStructure(s);
- currentWorld->addLight({player->loc.x + SCREEN_WIDTH/2, player->loc.y},{1.0f,1.0f,1.0f});
+ currentWorld->addLight({player->loc.x + SCREEN_WIDTH/2, player->loc.y}, 400.0f, {1.0f,1.0f,1.0f});
//currentWorld->getLastLight()->follow(currentWorld->build.back());
currentWorld->getLastLight()->makeFlame();
}