Use a different font and color for the bonus

This commit is contained in:
Lonami Exo 2017-02-10 18:54:06 +01:00
parent eb5591bcef
commit 15b836efd9
11 changed files with 44 additions and 11 deletions

View file

@ -0,0 +1,18 @@
info face="TheNextFont" size=64 bold=0 italic=0 charset="" unicode=0 stretchH=100 smooth=1 aa=1 padding=1,1,1,1 spacing=-2,-2
common lineHeight=65 base=48 scaleW=128 scaleH=256 pages=1 packed=0
page id=0 file="the-next-font.png"
chars count=13
char id=0 x=0 y=0 width=0 height=0 xoffset=-1 yoffset=47 xadvance=12 page=0 chnl=0
char id=32 x=0 y=0 width=0 height=0 xoffset=-1 yoffset=47 xadvance=12 page=0 chnl=0
char id=43 x=35 y=148 width=29 height=29 xoffset=2 yoffset=10 xadvance=33 page=0 chnl=0
char id=48 x=35 y=0 width=49 height=49 xoffset=2 yoffset=0 xadvance=53 page=0 chnl=0
char id=49 x=84 y=0 width=20 height=49 xoffset=2 yoffset=0 xadvance=23 page=0 chnl=0
char id=50 x=0 y=50 width=34 height=49 xoffset=2 yoffset=0 xadvance=37 page=0 chnl=0
char id=51 x=34 y=50 width=34 height=49 xoffset=2 yoffset=0 xadvance=38 page=0 chnl=0
char id=52 x=68 y=50 width=34 height=49 xoffset=1 yoffset=0 xadvance=36 page=0 chnl=0
char id=53 x=0 y=99 width=35 height=49 xoffset=2 yoffset=0 xadvance=39 page=0 chnl=0
char id=54 x=35 y=99 width=35 height=49 xoffset=2 yoffset=0 xadvance=39 page=0 chnl=0
char id=55 x=70 y=99 width=33 height=49 xoffset=2 yoffset=0 xadvance=37 page=0 chnl=0
char id=56 x=0 y=0 width=35 height=50 xoffset=2 yoffset=-1 xadvance=39 page=0 chnl=0
char id=57 x=0 y=148 width=35 height=49 xoffset=2 yoffset=0 xadvance=39 page=0 chnl=0
kernings count=0

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

View file

@ -17,6 +17,7 @@
], ],
"current_score": "c83737ff", "current_score": "c83737ff",
"high_score": "d400aaff", "high_score": "d400aaff",
"bonus": "e3e3e3ff",
"band": "2b5ccfff" "band": "2b5ccfff"
}, },
"cell_texture": "basic.png" "cell_texture": "basic.png"

View file

@ -17,6 +17,7 @@
], ],
"current_score": "ffcc00ff", "current_score": "ffcc00ff",
"high_score": "65d681ff", "high_score": "65d681ff",
"bonus": "4d4d4dff",
"band": "87ceebff" "band": "87ceebff"
}, },
"cell_texture": "basic.png" "cell_texture": "basic.png"

View file

@ -57,6 +57,7 @@ public class Klooni extends Game {
skin.add("font", new BitmapFont(Gdx.files.internal("font/geosans-light.fnt"))); skin.add("font", new BitmapFont(Gdx.files.internal("font/geosans-light.fnt")));
skin.add("font_small", new BitmapFont(Gdx.files.internal("font/geosans-light32.fnt"))); skin.add("font_small", new BitmapFont(Gdx.files.internal("font/geosans-light32.fnt")));
skin.add("font_bonus", new BitmapFont(Gdx.files.internal("font/the-next-font.fnt")));
// Use only one instance for the theme, so anyone using it uses the most up-to-date // Use only one instance for the theme, so anyone using it uses the most up-to-date
Theme.skin = skin; // Not the best idea Theme.skin = skin; // Not the best idea

View file

@ -27,6 +27,7 @@ public class Theme {
public Color currentScore; public Color currentScore;
public Color highScore; public Color highScore;
public Color bonus;
public Color bandColor; public Color bandColor;
private Color[] cells; private Color[] cells;
@ -109,6 +110,7 @@ public class Theme {
currentScore = new Color((int)Long.parseLong(colors.getString("current_score"), 16)); currentScore = new Color((int)Long.parseLong(colors.getString("current_score"), 16));
highScore = new Color((int)Long.parseLong(colors.getString("high_score"), 16)); highScore = new Color((int)Long.parseLong(colors.getString("high_score"), 16));
bonus = new Color((int)Long.parseLong(colors.getString("bonus"), 16));
bandColor = new Color((int)Long.parseLong(colors.getString("band"), 16)); bandColor = new Color((int)Long.parseLong(colors.getString("band"), 16));
emptyCell = new Color((int)Long.parseLong(colors.getString("empty_cell"), 16)); emptyCell = new Color((int)Long.parseLong(colors.getString("empty_cell"), 16));

View file

@ -27,7 +27,7 @@ class BonusParticle {
lifetime = 1f; lifetime = 1f;
// Render // Render
label.setColor(Klooni.theme.highScore); label.setColor(Klooni.theme.bonus);
label.setFontScale(Interpolation.elasticOut.apply(0f, 1f, lifetime)); label.setFontScale(Interpolation.elasticOut.apply(0f, 1f, lifetime));
float opacity = Interpolation.linear.apply(1f, 0f, lifetime); float opacity = Interpolation.linear.apply(1f, 0f, lifetime);
label.draw(batch, opacity); label.draw(batch, opacity);

View file

@ -7,13 +7,16 @@ import com.badlogic.gdx.utils.Array;
import java.util.Iterator; import java.util.Iterator;
import io.github.lonamiwebs.klooni.Klooni;
public class BonusParticleHandler { public class BonusParticleHandler {
private final Array<BonusParticle> particles; private final Array<BonusParticle> particles;
private final Label.LabelStyle labelStyle; private final Label.LabelStyle labelStyle;
public BonusParticleHandler(final Label.LabelStyle style) { public BonusParticleHandler(final Klooni game) {
labelStyle = style; labelStyle = new Label.LabelStyle();
labelStyle.font = game.skin.getFont("font_bonus");
particles = new Array<BonusParticle>(); particles = new Array<BonusParticle>();
} }

View file

@ -8,7 +8,6 @@ import com.badlogic.gdx.audio.Sound;
import com.badlogic.gdx.files.FileHandle; import com.badlogic.gdx.files.FileHandle;
import com.badlogic.gdx.graphics.GL20; import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.scenes.scene2d.ui.Label;
import java.io.DataInputStream; import java.io.DataInputStream;
import java.io.DataOutputStream; import java.io.DataOutputStream;
@ -88,10 +87,7 @@ class GameScreen implements Screen, InputProcessor, BinSerializable {
board = new Board(layout, BOARD_SIZE); board = new Board(layout, BOARD_SIZE);
holder = new PieceHolder(layout, HOLDER_PIECE_COUNT, board.cellSize); holder = new PieceHolder(layout, HOLDER_PIECE_COUNT, board.cellSize);
pauseMenu = new PauseMenuStage(layout, game, scorer, gameMode); pauseMenu = new PauseMenuStage(layout, game, scorer, gameMode);
bonusParticleHandler = new BonusParticleHandler(game);
Label.LabelStyle labelStyle = new Label.LabelStyle();
labelStyle.font = game.skin.getFont("font");
bonusParticleHandler = new BonusParticleHandler(labelStyle);
gameOverSound = Gdx.audio.newSound(Gdx.files.internal("sound/game_over.mp3")); gameOverSound = Gdx.audio.newSound(Gdx.files.internal("sound/game_over.mp3"));

View file

@ -27,6 +27,7 @@ template = '''{{
], ],
"current_score": "{current_score}", "current_score": "{current_score}",
"high_score": "{high_score}", "high_score": "{high_score}",
"bonus": "{bonus}",
"band": "{band}" "band": "{band}"
}}, }},
"cell_texture": "{cell_tex}" "cell_texture": "{cell_tex}"

View file

@ -26,8 +26,8 @@
inkscape:pageopacity="0.0" inkscape:pageopacity="0.0"
inkscape:pageshadow="2" inkscape:pageshadow="2"
inkscape:zoom="0.69999999" inkscape:zoom="0.69999999"
inkscape:cx="335.14124" inkscape:cx="28.553825"
inkscape:cy="488.33979" inkscape:cy="118.51475"
inkscape:document-units="px" inkscape:document-units="px"
inkscape:current-layer="layer1" inkscape:current-layer="layer1"
showgrid="false" showgrid="false"
@ -197,7 +197,8 @@
id="tspan4189">&quot;generate_theme.py&quot; to create &quot;out.theme&quot;</tspan></text> id="tspan4189">&quot;generate_theme.py&quot; to create &quot;out.theme&quot;</tspan></text>
<g <g
id="export_background" id="export_background"
style="fill:#e5e5e5;fill-opacity:1"> style="fill:#e5e5e5;fill-opacity:1"
transform="translate(3.0304577,0)">
<rect <rect
y="552.36218" y="552.36218"
x="0" x="0"
@ -280,5 +281,14 @@
id="rect4174" id="rect4174"
style="opacity:1;fill:#87ceeb;fill-opacity:1;stroke:none;stroke-width:25;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" /> style="opacity:1;fill:#87ceeb;fill-opacity:1;stroke:none;stroke-width:25;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
</g> </g>
<g
id="export_bonus"
style="fill:#4d4d4d;fill-opacity:1">
<path
inkscape:connector-curvature="0"
id="rect4180"
d="m 198.50901,1079.2067 c -6.43568,0 -11.61524,5.1815 -11.61524,11.6172 l 0,11.6172 -11.61718,0 c -6.43569,0 -11.61719,5.1815 -11.61719,11.6172 l 0,10.1015 c 0,6.4357 5.1815,11.6172 11.61719,11.6172 l 11.61718,0 0,11.6152 c 0,6.4357 5.17956,11.6172 11.61524,11.6172 l 10.10156,0 c 6.43568,0 11.61719,-5.1815 11.61719,-11.6172 l 0,-11.6152 11.61719,0 c 6.43568,0 11.61718,-5.1815 11.61718,-11.6172 l 0,-10.1015 c 0,-6.4357 -5.1815,-11.6172 -11.61718,-11.6172 l -11.61719,0 0,-11.6172 c 0,-6.4357 -5.18151,-11.6172 -11.61719,-11.6172 l -10.10156,0 z"
style="opacity:1;fill:#4d4d4d;fill-opacity:1;stroke:none;stroke-width:7.55499983;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
</g>
</g> </g>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 14 KiB