.setFillColor(0x7f3f00)
.setAnchor(0.5);
+ player.message = graphicEntityModule.createText()
+ .setX(p0 ? 15 : 1920-15)
+ .setY(680)
+ .setZIndex(1)
+ .setFontSize(40)
+ .setStrokeColor(0x000000)
+ .setFillColor(0xffbf7f)
+ .setAnchorX(p0 ? 0 : 1)
+ .setAnchorY(1);
+
player.castle = graphicEntityModule.createSprite()
.setImage("castle.png")
.setTint(player.getColorToken())
.setFillColor(0x12322a)
.setAnchor(0.5)
.setAlpha(0);
-
}
}
player.setScore(-1);
endGame();
}
+
+ player.message
+ .setText(player.getMessageString());
+ // .setAnchorX(/*player == p0 ? 0 : */ 1);
+ graphicEntityModule.commitEntityState(0, player.message);
}
if (delta > 0) {
}
private void endGame() {
- gameManager.endGame();
+ if (! gameManager.isGameEnd()) {
+ gameManager.endGame();
- if (p0.getScore() > p1.getScore()) {
- gameManager.addToGameSummary(GameManager.formatSuccessMessage(p0.getNicknameToken() + " wins"));
- destroyPlayer(p1);
- }
- else if (p0.getScore() < p1.getScore()) {
- gameManager.addToGameSummary(GameManager.formatSuccessMessage(p1.getNicknameToken() + " wins"));
- destroyPlayer(p0);
- }
- else if (p0.getScore() < 0) {
- gameManager.addToGameSummary(GameManager.formatErrorMessage("Everybody loses!"));
- destroyPlayer(p0);
- destroyPlayer(p1);
- }
- else {
- gameManager.addToGameSummary("Draw.");
+ if (p0.getScore() > p1.getScore()) {
+ gameManager.addToGameSummary(GameManager.formatSuccessMessage(p0.getNicknameToken() + " wins"));
+ destroyPlayer(p1);
+ }
+ else if (p0.getScore() < p1.getScore()) {
+ gameManager.addToGameSummary(GameManager.formatSuccessMessage(p1.getNicknameToken() + " wins"));
+ destroyPlayer(p0);
+ }
+ else if (p0.getScore() < 0) {
+ gameManager.addToGameSummary(GameManager.formatErrorMessage("Everybody loses!"));
+ destroyPlayer(p0);
+ destroyPlayer(p1);
+ }
+ else {
+ gameManager.addToGameSummary("Draw.");
+ }
}
}
}