fix: adjust car size and positioning on roads

- Scale down car sprites to 70% size for better visual fit
- Offset cars to the right side of roads using perpendicular
  positioning instead of centering them on the road path
This commit is contained in:
Brian Fertig 2026-06-12 16:06:10 -06:00
parent 2451e8fc66
commit 810c94da21
1 changed files with 5 additions and 2 deletions

View File

@ -606,7 +606,7 @@ export default class MiniMotorwaysGame extends Phaser.Scene {
ensureCarSprite(car) {
let rec = this.carSprites.get(car.id);
if (!rec) {
const c = this.add.container(0, 0).setDepth(D.cars);
const c = this.add.container(0, 0).setDepth(D.cars).setScale(0.7);
const img = this.add.image(0, 0, `mm-car-${car.color}`);
const pin = this.add.image(0, -12, 'mm-pin').setTint(COLOR_HEX[car.color]).setScale(0.8).setVisible(false);
c.add([img, pin]);
@ -1094,7 +1094,10 @@ export default class MiniMotorwaysGame extends Phaser.Scene {
if (!rr) continue;
const x = rr.px + (rr.cx - rr.px) * alpha;
const y = rr.py + (rr.cy - rr.py) * alpha + Math.sin(time * 0.011 + car.id) * 0.8;
rec.c.setPosition(x, y);
// Offset to the right side of the road (perpendicular to heading, right side)
const rightOffset = CELL * 0.12;
const rightAngle = rec.rot + Math.PI / 2;
rec.c.setPosition(x + rightOffset * Math.cos(rightAngle), y + rightOffset * Math.sin(rightAngle));
rec.c.setVisible(true);
rec.c.setDepth(car.mw ? D.motorway + 0.5 : D.cars);
let target = car.heading;