Ça trolle…
/
troll.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Debug the CG SDK. Errr… I mean leaguify maps.
[troll.git]
/
src
/
main
/
java
/
com
/
codingame
/
game
/
View.java
diff --git
a/src/main/java/com/codingame/game/View.java
b/src/main/java/com/codingame/game/View.java
index
52cfa64
..
cdc4428
100644
(file)
--- a/
src/main/java/com/codingame/game/View.java
+++ b/
src/main/java/com/codingame/game/View.java
@@
-26,25
+26,22
@@
class View {
* - first half: stone throw
* - second half: troll move
* The troll message is anchored around the troll move.
* - 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 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 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;
class Player {
Model.Player model;
@@
-156,8
+153,13
@@
class View {
graphicEntityModule.commitEntityState(0.0, stoneReminder);
}
graphicEntityModule.commitEntityState(0.0, stoneReminder);
}
+ void disqualify(String message) {
+ gameManager.addToGameSummary(GameManager.formatErrorMessage(nicknameToken + " " + message));
+ }
+
void victory() {
gameManager.addToGameSummary(GameManager.formatSuccessMessage(nicknameToken + " wins."));
void victory() {
gameManager.addToGameSummary(GameManager.formatSuccessMessage(nicknameToken + " wins."));
+ View.this.endgameFrame();
markWinner();
}
markWinner();
}
@@
-221,6
+223,7
@@
class View {
else {
stoneCounter.setText(stones + " stones");
}
else {
stoneCounter.setText(stones + " stones");
}
+ graphicEntityModule.commitEntityState(STONE_THROW_PEAK, stoneCounter);
}
void animateStones(int stones) {
}
void animateStones(int stones) {
@@
-275,6
+278,8
@@
class View {
void init(Model m) {
model = m;
void init(Model m) {
model = m;
+
+ gameManager.setFrameDuration(2000);
drawBackground();
/*
drawBackground();
/*
@@
-303,13
+308,19
@@
class View {
animateTurnCounter();
}
animateTurnCounter();
}
+ void endgameFrame() {
+ gameManager.setFrameDuration(2000);
+ }
+
void doubleDefeat() {
gameManager.addToGameSummary(GameManager.formatErrorMessage("Everybody loses!"));
void doubleDefeat() {
gameManager.addToGameSummary(GameManager.formatErrorMessage("Everybody loses!"));
+ endgameFrame();
animateLoss(1920/2, 680, 150, "L0SERZ!");
}
void draw() {
gameManager.addToGameSummary("Draw.");
animateLoss(1920/2, 680, 150, "L0SERZ!");
}
void draw() {
gameManager.addToGameSummary("Draw.");
+ endgameFrame();
animateLoss(1920/2, 680, 200, "DRAW");
}
animateLoss(1920/2, 680, 200, "DRAW");
}
@@
-513,7
+524,7
@@
class View {
pantsModule.displayOnToggleState(trollMessage, "verboseTrolling", true);
}
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();
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();
@@
-641,7
+652,7
@@
class View {
.setFillColor(0xff7f7f)
.setFontWeight(Text.FontWeight.BOLD)
.setTextAlign(TextBasedEntity.TextAlign.CENTER);
.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)
Curve curve = Curve.ELASTIC;
msg.setX(x, Curve.EASE_OUT)
.setY(y, Curve.ELASTIC)