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

@ -57,6 +57,7 @@ public class Klooni extends Game {
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_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
Theme.skin = skin; // Not the best idea

View file

@ -27,6 +27,7 @@ public class Theme {
public Color currentScore;
public Color highScore;
public Color bonus;
public Color bandColor;
private Color[] cells;
@ -109,6 +110,7 @@ public class Theme {
currentScore = new Color((int)Long.parseLong(colors.getString("current_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));
emptyCell = new Color((int)Long.parseLong(colors.getString("empty_cell"), 16));

View file

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

View file

@ -7,13 +7,16 @@ import com.badlogic.gdx.utils.Array;
import java.util.Iterator;
import io.github.lonamiwebs.klooni.Klooni;
public class BonusParticleHandler {
private final Array<BonusParticle> particles;
private final Label.LabelStyle labelStyle;
public BonusParticleHandler(final Label.LabelStyle style) {
labelStyle = style;
public BonusParticleHandler(final Klooni game) {
labelStyle = new Label.LabelStyle();
labelStyle.font = game.skin.getFont("font_bonus");
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.graphics.GL20;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.scenes.scene2d.ui.Label;
import java.io.DataInputStream;
import java.io.DataOutputStream;
@ -88,10 +87,7 @@ class GameScreen implements Screen, InputProcessor, BinSerializable {
board = new Board(layout, BOARD_SIZE);
holder = new PieceHolder(layout, HOLDER_PIECE_COUNT, board.cellSize);
pauseMenu = new PauseMenuStage(layout, game, scorer, gameMode);
Label.LabelStyle labelStyle = new Label.LabelStyle();
labelStyle.font = game.skin.getFont("font");
bonusParticleHandler = new BonusParticleHandler(labelStyle);
bonusParticleHandler = new BonusParticleHandler(game);
gameOverSound = Gdx.audio.newSound(Gdx.files.internal("sound/game_over.mp3"));