From 68040800202e59f4bdda525f75b36b9ec3a3ca93 Mon Sep 17 00:00:00 2001 From: JBM Date: Sat, 23 May 2020 00:23:53 +0200 Subject: [PATCH] Stone throw reminder for @dbdr's debugging. Also UI stuff. Namely: * pixel tweaks in frame backgrounds * "random" frame sprite orientation --- src/main/java/com/codingame/game/View.java | 41 +++++++++++++++++--- src/main/resources/view/assets/frame.png | Bin 6736 -> 6737 bytes src/main/resources/view/assets/frame_bg.png | Bin 817 -> 3148 bytes 3 files changed, 35 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/codingame/game/View.java b/src/main/java/com/codingame/game/View.java index 7f883aa..cd67f86 100644 --- a/src/main/java/com/codingame/game/View.java +++ b/src/main/java/com/codingame/game/View.java @@ -17,15 +17,19 @@ class View { class Player { Model.Player model; + int colorToken; String nicknameToken; String avatarToken; + double frameRot; + Group avatar; Text stoneCounter; Text message; Sprite castle; Text stone; + Text stoneReminder; void init(com.codingame.game.Player p) { model = p.model; @@ -37,16 +41,17 @@ class View { int x = p0 ? 280 : 1920 - 280; int y = 220; - Sprite border1 = graphicEntityModule.createSprite() + Sprite frame = graphicEntityModule.createSprite() .setImage("frame.png") .setAnchor(0.5) - .setScale(p0 ? -1 : 1) + .setRotation(frameRot) .setZIndex(22) .setTint(colorToken); - Sprite border2 = graphicEntityModule.createSprite() + Sprite frameBg = graphicEntityModule.createSprite() .setImage("frame_bg.png") .setAnchor(0.5) + .setRotation(frameRot) .setZIndex(20); Sprite avatarSprite = graphicEntityModule.createSprite() @@ -57,7 +62,7 @@ class View { .setBaseWidth(116); avatar = graphicEntityModule - .createGroup(border1, border2, avatarSprite) + .createGroup(frame, frameBg, avatarSprite) .setX(x).setY(y); Text text = graphicEntityModule.createText(nicknameToken) @@ -82,7 +87,6 @@ class View { .setY(680) .setZIndex(1) .setFontSize(40) - .setStrokeColor(0x000000) .setFillColor(0xffbf7f) .setAnchorX(p0 ? 0 : 1) .setAnchorY(1); @@ -103,6 +107,15 @@ class View { .setFillColor(0x12322a) .setAnchor(0.5) .setAlpha(0); + + stoneReminder = graphicEntityModule.createText() + .setX(p0 ? x + 100 : x - 100) + .setY(y) + .setZIndex(20) + .setFontSize(75) + .setFillColor(0x3f3f3f) + .setAnchorX(p0 ? 0 : 1) + .setAnchorY(0.5); } void updateStoneCounter() { @@ -121,9 +134,10 @@ class View { } void animateStones(int stones) { + String stonesString = new Integer(stones).toString(); stone.setX(castle.getX()); stone.setY(castle.getY() - 100); - stone.setText(new Integer(stones).toString()); + stone.setText(stonesString); stone.setAlpha(1); graphicEntityModule.commitEntityState(0, stone); @@ -139,6 +153,13 @@ class View { stone.setY(troll.getY() - 50, Curve.EASE_IN); stone.setAlpha(0, Curve.EASE_IN); graphicEntityModule.commitEntityState(0.5, stone); + + stoneReminder.setAlpha(0); + graphicEntityModule.commitEntityState(0, stoneReminder); + stoneReminder.setText(stonesString); + graphicEntityModule.commitEntityState(0.25, stoneReminder); + stoneReminder.setAlpha(1); + graphicEntityModule.commitEntityState(0.5, stoneReminder); } void displayMessage(String msg) { @@ -165,7 +186,15 @@ class View { model = m; drawBackground(); + /* + * Random π/2-grained rotation of the avatar frames. Avoid + * having them π/2 apart, though, as one of them is likely + * going to end upside-down and the trick would be revealed. + * And I'd have to "draw" a new frame. Ewww. + */ + p0.frameRot = random.nextInt(4) * Math.PI / 2; p0.init(gameManager.getPlayer(0)); + p1.frameRot = p1.frameRot + (random.nextInt(2) == 1 ? 1 : -1) * Math.PI / 2; p1.init(gameManager.getPlayer(1)); drawTroll(); diff --git a/src/main/resources/view/assets/frame.png b/src/main/resources/view/assets/frame.png index 5f815887a5ad1bce3a611aa5b97ac5a0115491c7..a90ea20120b07ae8cf0fadcd39b964e71760c7ac 100644 GIT binary patch delta 426 zcmV;b0agCcG|@DWB!7l!LqkwWLqi~Na&Km7Y-IodD3N`UJxIeq9K~N#iy{>VtB5#c zs19O5R77ymDionYs1;guFuC*#nlvOSE{=k0!NHHks)LKOt`4q(Aou~|}?mh0_0YbING^=e4&~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