]> git.mxchange.org Git - quix0rs-blobwars.git/commitdiff
Don't let bubbles escape the liquid they are in.
authorGuus Sliepen <guus@debian.org>
Sun, 9 Aug 2015 15:26:41 +0000 (17:26 +0200)
committerGuus Sliepen <guus@debian.org>
Sun, 9 Aug 2015 15:26:41 +0000 (17:26 +0200)
src/defs.h
src/particles.cpp

index c8b468fcefa331a812d0792a53c0cba0c6678d82..d358d3effa040a052c76eab08ab98d130fc2a81d 100644 (file)
@@ -252,6 +252,7 @@ const char skill[][10] = {
 
 #define PAR_WEIGHTLESS 1
 #define PAR_COLLIDES   2
+#define PAR_LIQUID      4
 
 /* ######### effect flags ########### */
 
index 66595ab597eb2a3c678c576526930aeb0093a227..ea38ede85914a30ff2aa03b4e3fec1bcf5748528 100644 (file)
@@ -94,7 +94,7 @@ 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 +187,14 @@ void doParticles()
                        }
                }
 
+               if (particle->flags & PAR_LIQUID)
+               {
+                       if (!map.isLiquid(x, y))
+                       {
+                               particle->health = 0;
+                       }
+               }
+
                if (particle->health > 0)
                {
                        previous = particle;