From bc13ad7d95bd8b13e63527999f134ff339b78ab8 Mon Sep 17 00:00:00 2001
From: Paolo Brasolin <paolo.brasolin@eurac.edu>
Date: Tue, 5 Apr 2022 18:16:32 +0200
Subject: [PATCH] feat: #fe clue placement avoids clues in flight and high
 piles

---
 frontend/src/js/clue.ts | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/frontend/src/js/clue.ts b/frontend/src/js/clue.ts
index 21509a3..251e9d5 100644
--- a/frontend/src/js/clue.ts
+++ b/frontend/src/js/clue.ts
@@ -102,7 +102,8 @@ class Clue extends Phaser.GameObjects.Sprite {
         let intersect = true;
         intersect &&= clueBounds.left - pad < x;
         intersect &&= x < clueBounds.right + pad;
-        xs[i] += intersect;
+        const pileHeight = bounds.bottom - clueBounds.bottom;
+        xs[i] += (intersect ? 1 : 0) * pileHeight;
       });
     });
 
-- 
GitLab