]> code.bitgloo.com Git - clyne/gamedev.git/commitdiff
Lighting!
authordrumsetmonkey <abelleisle@roadrunner.com>
Wed, 8 Jun 2016 12:45:29 +0000 (08:45 -0400)
committerdrumsetmonkey <abelleisle@roadrunner.com>
Wed, 8 Jun 2016 12:45:29 +0000 (08:45 -0400)
14 files changed:
1  2 
assets/blankNormal.png
assets/cat_normal.png
assets/cat_normal_old.png
assets/items/basic_torch.png
assets/style/classic/bg/bgnew.png
assets/style/classic/bg/star.png
include/common.hpp
include/entities.hpp
include/world.hpp
main.cpp
src/mob.cpp
src/ui.cpp
src/world.cpp
xml/playerSpawnHill1.xml

index 0000000000000000000000000000000000000000,0000000000000000000000000000000000000000..cff3ee726a8782021af767334936e7edceeeab13
new file mode 100644 (file)
Binary files differ
index 0000000000000000000000000000000000000000,0000000000000000000000000000000000000000..59aaee8777f87bfc967c062286fc4d503697b7a3
new file mode 100644 (file)
Binary files differ
index 0000000000000000000000000000000000000000,0000000000000000000000000000000000000000..c3ed4aa6fdaed3231998d28de85700132d2cdcec
new file mode 100644 (file)
Binary files differ
index 0000000000000000000000000000000000000000,0000000000000000000000000000000000000000..fe6a994e262624562a7cb6133cbb95f0e02a31a1
new file mode 100644 (file)
Binary files differ
index 0000000000000000000000000000000000000000,0000000000000000000000000000000000000000..05c352b770ca23f6c88d10517ac7f1865fc7267c
new file mode 100644 (file)
Binary files differ
index 0000000000000000000000000000000000000000,0000000000000000000000000000000000000000..6360d30c762e7c0d5608ea4aede15f69c9ef24e7
new file mode 100644 (file)
Binary files differ
Simple merge
index d2185c4cd1582cc2c2760818719e10ba569344c8,e406397ccb742583047aeb3a798cb2de68aa1ecf..7c712c98d07b73d51e6bfd6de249539d3f79db77
@@@ -412,16 -368,73 +369,80 @@@ public
                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>
Simple merge
diff --cc main.cpp
Simple merge
diff --cc src/mob.cpp
index a0e70873754204771dbbb9a2612bc271a2217c47,526d7b102808e4bc383526f45153376957444806..1bc1499dbc61ef7964430563325071b17925ec6a
@@@ -143,13 -146,14 +146,14 @@@ void Cat::onHit(unsigned int _health
  
  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;
diff --cc src/ui.cpp
index 1f6e593d155d2aeb9b6e88ce8ef3b15bb108928d,ae47234163b1dc467972076b9d71e0013e0f0f19..f32bc79c9869526163aabf56738ea8a3582329cd
@@@ -1408,8 -1408,10 +1408,10 @@@ EXIT
                                        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();
                                        }
diff --cc src/world.cpp
Simple merge
Simple merge