From 5c8d8d332a271b24fba9d3a2ea74a43bda8e70bd Mon Sep 17 00:00:00 2001 From: JBM Date: Sat, 23 May 2020 02:06:33 +0200 Subject: [PATCH] Randomize defeated avatar rotation direction --- src/main/java/com/codingame/game/View.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/codingame/game/View.java b/src/main/java/com/codingame/game/View.java index db7584c..b8d42c4 100644 --- a/src/main/java/com/codingame/game/View.java +++ b/src/main/java/com/codingame/game/View.java @@ -167,7 +167,8 @@ class View { void destroy() { graphicEntityModule.commitEntityState(0.5, avatar); - avatar.setRotation(170*Math.PI/180, Curve.ELASTIC); + int dir = random.nextInt(2) == 1 ? 1 : -1; + avatar.setRotation(dir * 170 * Math.PI / 180, Curve.ELASTIC); graphicEntityModule.commitEntityState(0.5, castle); castle.setX(castle.getX(), Curve.ELASTIC); -- 2.30.2