From 77e334e1925f2175d6bbe649192041043fe74a17 Mon Sep 17 00:00:00 2001 From: Brian Fertig Date: Sun, 7 Jun 2026 14:52:07 -0600 Subject: [PATCH] fix: outward pawn hop animation on bottom row MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Track `fromSpace` before incrementing position for arc direction logic - Flip Bézier control point for spaces 20–29 so pawns hop outward (away from center) - Fixes awkward inward arc that made pieces clip through the board on the bottom edge --- public/src/games/monopoly/MonopolyGame.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/public/src/games/monopoly/MonopolyGame.js b/public/src/games/monopoly/MonopolyGame.js index 58a823a..a8f43a0 100644 --- a/public/src/games/monopoly/MonopolyGame.js +++ b/public/src/games/monopoly/MonopolyGame.js @@ -1191,6 +1191,7 @@ export default class MonopolyGame extends Phaser.Scene { const hopOne = () => { if (step >= steps) { resolve(); return; } step++; + const fromSpace = cur; cur = (cur + 1) % 40; const start = { x: pawn.x, y: pawn.y }; @@ -1204,10 +1205,13 @@ export default class MonopolyGame extends Phaser.Scene { const dx = BOARD_CX - mx; const dy = BOARD_CY - my; const dist = Math.hypot(dx, dy); - const nx = dist > 0 ? dx / dist : 0; - const ny = dist > 0 ? dy / dist : -1; + let nx = dist > 0 ? dx / dist : 0; + let ny = dist > 0 ? dy / dist : -1; - // Quadratic Bézier control point: ARCH_H px toward board center from midpoint + // Top row (spaces 20–29): arch away from center so the piece hops outward + if (fromSpace >= 20 && fromSpace <= 29) { nx = -nx; ny = -ny; } + + // Quadratic Bézier control point: ARCH_H px toward/away from board center const ctrl = { x: mx + nx * ARCH_H, y: my + ny * ARCH_H }; const proxy = { t: 0 };