From: Guus Sliepen Date: Sun, 9 Aug 2015 15:26:41 +0000 (+0200) Subject: Don't let bubbles escape the liquid they are in. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=cb4e61ff51c939f6b28e62b083f80d4b815ef515;p=quix0rs-blobwars.git Don't let bubbles escape the liquid they are in. --- diff --git a/src/defs.h b/src/defs.h index c8b468f..d358d3e 100644 --- a/src/defs.h +++ b/src/defs.h @@ -252,6 +252,7 @@ const char skill[][10] = { #define PAR_WEIGHTLESS 1 #define PAR_COLLIDES 2 +#define PAR_LIQUID 4 /* ######### effect flags ########### */ diff --git a/src/particles.cpp b/src/particles.cpp index 66595ab..ea38ede 100644 --- a/src/particles.cpp +++ b/src/particles.cpp @@ -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;