* - first half: stone throw
* - second half: troll move
* The troll message is anchored around the troll move.
- *
- * The castle destruction is currently ad hoc simultaneously with
- * the troll move, but this ought to change if I get some
- * lengthened frame system ready.
- *
- * The endgame message is completely ad hoc, and really ought to
- * improve.
*/
- private final double AVATAR_ANIMATION_START = 0.5;
private final double STONE_THROW_START = 0.0;
private final double STONE_THROW_PEAK = 0.25;
private final double STONE_THROW_END = 0.5;
- private final double CASTLE_DESTRUCTION_START = 0.5;
- private final double CASTLE_DESTRUCTION_END = 1.0;
private final double TROLL_MOVE_START = 0.5;
private final double TROLL_MOVE_END = 1.0;
private final double TROLL_MESSAGE_START = 0.5;
private final double TROLL_MESSAGE_END = 1.0;
- private final double ENDGAME_MESSAGE_START = 0.25;
+
+ /*
+ * Castle destruction and endgame message pertain to an endgame
+ * frame only.
+ */
+ private final double AVATAR_ANIMATION_START = 0.5;
+ private final double CASTLE_DESTRUCTION_START = 0.0;
+ private final double CASTLE_DESTRUCTION_END = 0.5;
class Player {
Model.Player model;
void victory() {
gameManager.addToGameSummary(GameManager.formatSuccessMessage(nicknameToken + " wins."));
+ View.this.endgameFrame();
markWinner();
}
else {
stoneCounter.setText(stones + " stones");
}
+ graphicEntityModule.commitEntityState(STONE_THROW_PEAK, stoneCounter);
}
void animateStones(int stones) {
animateTurnCounter();
}
+ void endgameFrame() {
+ gameManager.setFrameDuration(2000);
+ }
+
void doubleDefeat() {
gameManager.addToGameSummary(GameManager.formatErrorMessage("Everybody loses!"));
+ endgameFrame();
animateLoss(1920/2, 680, 150, "L0SERZ!");
}
void draw() {
gameManager.addToGameSummary("Draw.");
+ endgameFrame();
animateLoss(1920/2, 680, 200, "DRAW");
}
pantsModule.displayOnToggleState(trollMessage, "verboseTrolling", true);
}
- private void moveTroll() {
+ void moveTroll() {
graphicEntityModule.commitEntityState(TROLL_MOVE_START, troll, trollPositionGauge);
int x0 = p0.castle.getX(), x1 = p1.castle.getX();
int y0 = p0.castle.getY(), y1 = p1.castle.getY();
.setFillColor(0xff7f7f)
.setFontWeight(Text.FontWeight.BOLD)
.setTextAlign(TextBasedEntity.TextAlign.CENTER);
- graphicEntityModule.commitEntityState(ENDGAME_MESSAGE_START, msg);
+ graphicEntityModule.commitEntityState(0.0, msg);
Curve curve = Curve.ELASTIC;
msg.setX(x, Curve.EASE_OUT)
.setY(y, Curve.ELASTIC)