Add a new waterdrop effect
BIN
android/assets/sound/effect_waterdrop.mp3
Normal file
BIN
android/assets/ui/x0.75/cells/drop.png
Normal file
After Width: | Height: | Size: 942 B |
BIN
android/assets/ui/x1.0/cells/drop.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
android/assets/ui/x1.25/cells/drop.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
android/assets/ui/x1.5/cells/drop.png
Normal file
After Width: | Height: | Size: 2 KiB |
BIN
android/assets/ui/x2.0/cells/drop.png
Normal file
After Width: | Height: | Size: 2.9 KiB |
BIN
android/assets/ui/x4.0/cells/drop.png
Normal file
After Width: | Height: | Size: 6.7 KiB |
|
@ -30,6 +30,7 @@ import com.badlogic.gdx.scenes.scene2d.ui.Skin;
|
||||||
import io.github.lonamiwebs.klooni.effects.EvaporateEffect;
|
import io.github.lonamiwebs.klooni.effects.EvaporateEffect;
|
||||||
import io.github.lonamiwebs.klooni.effects.IEffect;
|
import io.github.lonamiwebs.klooni.effects.IEffect;
|
||||||
import io.github.lonamiwebs.klooni.effects.VanishEffect;
|
import io.github.lonamiwebs.klooni.effects.VanishEffect;
|
||||||
|
import io.github.lonamiwebs.klooni.effects.WaterdropEffect;
|
||||||
import io.github.lonamiwebs.klooni.game.Cell;
|
import io.github.lonamiwebs.klooni.game.Cell;
|
||||||
import io.github.lonamiwebs.klooni.screens.MainMenuScreen;
|
import io.github.lonamiwebs.klooni.screens.MainMenuScreen;
|
||||||
import io.github.lonamiwebs.klooni.screens.TransitionScreen;
|
import io.github.lonamiwebs.klooni.screens.TransitionScreen;
|
||||||
|
@ -119,6 +120,8 @@ public class Klooni extends Game {
|
||||||
|
|
||||||
// Effects used when clearing a row
|
// Effects used when clearing a row
|
||||||
public static IEffect createEffect(final Cell deadCell, final Vector2 culprit) {
|
public static IEffect createEffect(final Cell deadCell, final Vector2 culprit) {
|
||||||
|
// TODO Every effect should probably return a string corresponding to their sound
|
||||||
|
// so there's only one switch around
|
||||||
final IEffect effect;
|
final IEffect effect;
|
||||||
switch (usedEffect) {
|
switch (usedEffect) {
|
||||||
default:
|
default:
|
||||||
|
@ -126,6 +129,9 @@ public class Klooni extends Game {
|
||||||
effect = new VanishEffect();
|
effect = new VanishEffect();
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
|
effect = new WaterdropEffect();
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
effect = new EvaporateEffect();
|
effect = new EvaporateEffect();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -235,6 +241,9 @@ public class Klooni extends Game {
|
||||||
effectSound = Gdx.audio.newSound(Gdx.files.internal("sound/effect_vanish.mp3"));
|
effectSound = Gdx.audio.newSound(Gdx.files.internal("sound/effect_vanish.mp3"));
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
|
effectSound = Gdx.audio.newSound(Gdx.files.internal("sound/effect_waterdrop.mp3"));
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
effectSound = Gdx.audio.newSound(Gdx.files.internal("sound/effect_evaporate.mp3"));
|
effectSound = Gdx.audio.newSound(Gdx.files.internal("sound/effect_evaporate.mp3"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -245,7 +254,8 @@ public class Klooni extends Game {
|
||||||
// and when creating instances of a lot of effects it's better if we can
|
// and when creating instances of a lot of effects it's better if we can
|
||||||
// save some processor cycles.
|
// save some processor cycles.
|
||||||
if (name.equals("vanish")) return 0;
|
if (name.equals("vanish")) return 0;
|
||||||
if (name.equals("evaporate")) return 1;
|
if (name.equals("waterdrop")) return 1;
|
||||||
|
if (name.equals("evaporate")) return 2;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,69 @@
|
||||||
|
package io.github.lonamiwebs.klooni.effects;
|
||||||
|
|
||||||
|
|
||||||
|
import com.badlogic.gdx.Gdx;
|
||||||
|
import com.badlogic.gdx.graphics.Color;
|
||||||
|
import com.badlogic.gdx.graphics.Texture;
|
||||||
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
|
||||||
|
import com.badlogic.gdx.math.MathUtils;
|
||||||
|
import com.badlogic.gdx.math.Vector2;
|
||||||
|
|
||||||
|
import io.github.lonamiwebs.klooni.SkinLoader;
|
||||||
|
import io.github.lonamiwebs.klooni.game.Cell;
|
||||||
|
|
||||||
|
public class WaterdropEffect implements IEffect {
|
||||||
|
private Vector2 pos;
|
||||||
|
|
||||||
|
private Color cellColor;
|
||||||
|
private Color dropColor;
|
||||||
|
private float cellSize;
|
||||||
|
|
||||||
|
private final float fallAcceleration;
|
||||||
|
private float fallSpeed;
|
||||||
|
|
||||||
|
private static final float FALL_ACCELERATION = 500.0f;
|
||||||
|
private static final float FALL_VARIATION = 50.0f;
|
||||||
|
private static final float COLOR_SPEED = 7.5f;
|
||||||
|
|
||||||
|
private static Texture dropTexture;
|
||||||
|
|
||||||
|
static {
|
||||||
|
dropTexture = SkinLoader.loadPng("cells/drop.png");
|
||||||
|
}
|
||||||
|
|
||||||
|
public WaterdropEffect() {
|
||||||
|
fallAcceleration = FALL_ACCELERATION + MathUtils.random(-FALL_VARIATION, FALL_VARIATION);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setInfo(Cell deadCell, Vector2 culprit) {
|
||||||
|
pos = deadCell.pos.cpy();
|
||||||
|
cellSize = deadCell.size;
|
||||||
|
cellColor = deadCell.getColorCopy();
|
||||||
|
dropColor = new Color(cellColor.r, cellColor.g, cellColor.b, 0.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void draw(SpriteBatch batch) {
|
||||||
|
final float dt = Gdx.graphics.getDeltaTime();
|
||||||
|
fallSpeed += fallAcceleration * dt;
|
||||||
|
pos.y -= fallSpeed * dt;
|
||||||
|
|
||||||
|
cellColor.set(
|
||||||
|
cellColor.r, cellColor.g, cellColor.b,
|
||||||
|
Math.max(cellColor.a - COLOR_SPEED * dt, 0.0f)
|
||||||
|
);
|
||||||
|
dropColor.set(
|
||||||
|
cellColor.r, cellColor.g, cellColor.b,
|
||||||
|
Math.min(dropColor.a + COLOR_SPEED * dt, 1.0f)
|
||||||
|
);
|
||||||
|
|
||||||
|
Cell.draw(cellColor, batch, pos.x, pos.y, cellSize);
|
||||||
|
Cell.draw(dropTexture, dropColor, batch, pos.x, pos.y, cellSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isDone() {
|
||||||
|
return pos.y + dropTexture.getHeight() < 0;
|
||||||
|
}
|
||||||
|
}
|
|
@ -19,6 +19,22 @@
|
||||||
sodipodi:docname="buttons.svg">
|
sodipodi:docname="buttons.svg">
|
||||||
<defs
|
<defs
|
||||||
id="defs4">
|
id="defs4">
|
||||||
|
<linearGradient
|
||||||
|
inkscape:collect="always"
|
||||||
|
id="linearGradient4666">
|
||||||
|
<stop
|
||||||
|
style="stop-color:#ffffff;stop-opacity:1"
|
||||||
|
offset="0"
|
||||||
|
id="stop4662" />
|
||||||
|
<stop
|
||||||
|
id="stop4676"
|
||||||
|
offset="0.42713729"
|
||||||
|
style="stop-color:#ffffff;stop-opacity:0.79607844" />
|
||||||
|
<stop
|
||||||
|
style="stop-color:#ffffff;stop-opacity:0.4627451"
|
||||||
|
offset="1"
|
||||||
|
id="stop4664" />
|
||||||
|
</linearGradient>
|
||||||
<linearGradient
|
<linearGradient
|
||||||
inkscape:collect="always"
|
inkscape:collect="always"
|
||||||
id="linearGradient4659">
|
id="linearGradient4659">
|
||||||
|
@ -117,6 +133,17 @@
|
||||||
r="6.9998441"
|
r="6.9998441"
|
||||||
gradientUnits="userSpaceOnUse"
|
gradientUnits="userSpaceOnUse"
|
||||||
gradientTransform="matrix(0.43721182,3.7482347e-7,-3.6476786e-7,0.42548248,33.63808,466.20236)" />
|
gradientTransform="matrix(0.43721182,3.7482347e-7,-3.6476786e-7,0.42548248,33.63808,466.20236)" />
|
||||||
|
<radialGradient
|
||||||
|
inkscape:collect="always"
|
||||||
|
xlink:href="#linearGradient4666"
|
||||||
|
id="radialGradient4670"
|
||||||
|
cx="182.82529"
|
||||||
|
cy="803.41022"
|
||||||
|
fx="182.82529"
|
||||||
|
fy="803.41022"
|
||||||
|
r="17.166115"
|
||||||
|
gradientTransform="matrix(1.3089405,0.20493947,-0.2507187,1.6013308,145.62096,-521.43256)"
|
||||||
|
gradientUnits="userSpaceOnUse" />
|
||||||
</defs>
|
</defs>
|
||||||
<sodipodi:namedview
|
<sodipodi:namedview
|
||||||
id="base"
|
id="base"
|
||||||
|
@ -125,9 +152,9 @@
|
||||||
borderopacity="1"
|
borderopacity="1"
|
||||||
inkscape:pageopacity="0"
|
inkscape:pageopacity="0"
|
||||||
inkscape:pageshadow="2"
|
inkscape:pageshadow="2"
|
||||||
inkscape:zoom="0.82062205"
|
inkscape:zoom="1"
|
||||||
inkscape:cx="328.41208"
|
inkscape:cx="-18.655028"
|
||||||
inkscape:cy="62.530961"
|
inkscape:cy="163.7511"
|
||||||
inkscape:document-units="px"
|
inkscape:document-units="px"
|
||||||
inkscape:current-layer="layer1"
|
inkscape:current-layer="layer1"
|
||||||
showgrid="false"
|
showgrid="false"
|
||||||
|
@ -1155,5 +1182,29 @@
|
||||||
d="m 28.96558,851.96616 c 0.835392,-0.69063 1.986545,-1.09077 3.070271,-1.07103 1.047321,0.0191 2.170527,0.41835 2.927466,1.14243 0.977909,0.93545 1.646441,2.3596 1.642238,3.71288 l -0.0714,22.99133 c -0.0026,0.83573 -0.291448,1.74078 -0.85682,2.35626 -0.958108,1.04302 -2.439879,1.8216 -3.855688,1.78503 -1.479356,-0.0382 -3.055098,-0.87499 -3.927089,-2.07064 -0.484195,-0.66392 -0.425936,-1.60594 -0.428411,-2.42766 l -0.0714,-23.70534 c -0.0031,-1.04505 0.765383,-2.04738 1.570833,-2.71326 z"
|
d="m 28.96558,851.96616 c 0.835392,-0.69063 1.986545,-1.09077 3.070271,-1.07103 1.047321,0.0191 2.170527,0.41835 2.927466,1.14243 0.977909,0.93545 1.646441,2.3596 1.642238,3.71288 l -0.0714,22.99133 c -0.0026,0.83573 -0.291448,1.74078 -0.85682,2.35626 -0.958108,1.04302 -2.439879,1.8216 -3.855688,1.78503 -1.479356,-0.0382 -3.055098,-0.87499 -3.927089,-2.07064 -0.484195,-0.66392 -0.425936,-1.60594 -0.428411,-2.42766 l -0.0714,-23.70534 c -0.0031,-1.04505 0.765383,-2.04738 1.570833,-2.71326 z"
|
||||||
style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.93750006px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
|
style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.93750006px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
|
||||||
</g>
|
</g>
|
||||||
|
<g
|
||||||
|
id="drop">
|
||||||
|
<g
|
||||||
|
style="fill:#808080"
|
||||||
|
id="g4655"
|
||||||
|
inkscape:export-xdpi="90"
|
||||||
|
inkscape:export-ydpi="90"
|
||||||
|
transform="matrix(3.0000588,0,0,3.0000588,164.80126,-2123.8991)">
|
||||||
|
<rect
|
||||||
|
ry="0"
|
||||||
|
y="966.36218"
|
||||||
|
x="0"
|
||||||
|
height="16"
|
||||||
|
width="16"
|
||||||
|
id="rect4651"
|
||||||
|
style="opacity:1;fill:none;fill-opacity:1;stroke:none;stroke-width:0.1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
|
||||||
|
</g>
|
||||||
|
<path
|
||||||
|
sodipodi:nodetypes="ssscs"
|
||||||
|
inkscape:connector-curvature="0"
|
||||||
|
id="path4659"
|
||||||
|
d="m 205.96784,806.0791 c 0,9.48058 -7.68553,17.16612 -17.16611,17.16612 -9.48059,0 -17.16612,-7.68553 -17.16612,-17.16612 0,-9.48059 17.16612,-30.83148 17.16612,-30.83148 0,0 17.16611,21.3509 17.16611,30.83148 z"
|
||||||
|
style="fill:url(#radialGradient4670);fill-opacity:1;stroke:none;stroke-width:1.15489137;stroke-opacity:1" />
|
||||||
|
</g>
|
||||||
</g>
|
</g>
|
||||||
</svg>
|
</svg>
|
||||||
|
|
Before Width: | Height: | Size: 75 KiB After Width: | Height: | Size: 77 KiB |
|
@ -41,7 +41,8 @@ ids = [
|
||||||
cells = [
|
cells = [
|
||||||
'basic',
|
'basic',
|
||||||
'bubble',
|
'bubble',
|
||||||
'ghost'
|
'ghost',
|
||||||
|
'drop'
|
||||||
]
|
]
|
||||||
|
|
||||||
inkscape_default_dpi = 90
|
inkscape_default_dpi = 90
|
||||||
|
|