]> git.mxchange.org Git - quix0rs-blobwars.git/blobdiff - src/particles.cpp
Added .gitignore to ignore certain files + fixed access rights on Makefile* as
[quix0rs-blobwars.git] / src / particles.cpp
index 66595ab597eb2a3c678c576526930aeb0093a227..79f71efcab2b5f0c1fbfa46be6e70c3063861ebd 100644 (file)
@@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
 void addWindParticles()
 {
-       int c = graphics.white;
+       int c;
        float x, y, dx, dy;
        
 
@@ -87,14 +87,17 @@ void addFireTrailParticle(float x, float y)
 
 void addFireParticles(float x, float y, int amount)
 {
-       map.addParticle(x + Math::rrand(-2, 2), y + Math::rrand(-2, 2), 0, 1, Math::rrand(5, 30), graphics.red, graphics.getSprite("Explosion", true), PAR_COLLIDES);
+       for (int i = 0 ; i < amount ; i++)
+       {
+               map.addParticle(x + Math::rrand(-2, 2), y + Math::rrand(-2, 2), 0, 1, Math::rrand(5, 30), graphics.red, graphics.getSprite("Explosion", true), PAR_COLLIDES);
+       }
 }
 
 void addBubble(float x, float y)
 {
        if ((Math::prand() % 50) == 0)
        {
-               map.addParticle(x + Math::prand() % BRICKSIZE, y + 19, 0, Math::rrand(-3, -1), Math::rrand(30, 90), graphics.red, graphics.getSprite("Bubble", true), PAR_COLLIDES + PAR_WEIGHTLESS);
+               map.addParticle(x + Math::prand() % BRICKSIZE, y + 19, 0, Math::rrand(-3, -1), Math::rrand(30, 90), graphics.red, graphics.getSprite("Bubble", true), PAR_COLLIDES | PAR_WEIGHTLESS | PAR_LIQUID);
        }
 }
 
@@ -187,6 +190,14 @@ void doParticles()
                        }
                }
 
+               if (particle->flags & PAR_LIQUID)
+               {
+                       if (!map.isLiquid(x, y))
+                       {
+                               particle->health = 0;
+                       }
+               }
+
                if (particle->health > 0)
                {
                        previous = particle;