Fix camera judder on fast ascent

Root cause: startFollow used lerpY=0.05 + roundPixels=true. At rocket
velocity (~1400 px/s) the camera lagged ~466px behind the player, then
snapped in chunks every frame, giving the impression of low FPS / shake.

Fix:
- Replace startFollow with manual upward-only camera tracking that
  matches the player exactly (doodle-jump standard behavior)
- Disable camera roundPixels so antialiasing actually smooths motion
- Round bg tilePositionY to integer to avoid grid texture shimmer
- Slightly thin out boost effects (flame 3->2/frame, speed line 40->65ms)
  to keep frame budget headroom on weaker devices
This commit is contained in:
2026-05-23 18:50:58 +07:00
parent de1a3fcf56
commit 07b670fb09
2 changed files with 13 additions and 4 deletions

View File

@@ -21,7 +21,7 @@ export class EffectsManager {
else this._spawnWind(player);
this.speedLineTimer += delta;
if (this.speedLineTimer > 40) {
if (this.speedLineTimer > 65) {
this.speedLineTimer = 0;
this._spawnSpeedLine();
}
@@ -70,7 +70,7 @@ export class EffectsManager {
_spawnFlame(player) {
const baseY = player.y + player.displayHeight / 2 - 6;
const count = 3;
const count = 2;
for (let i = 0; i < count; i++) {
const jitter = Phaser.Math.Between(-9, 9);
const color = Phaser.Utils.Array.GetRandom(FLAME_COLORS);

View File

@@ -60,7 +60,10 @@ export class GameScene extends Scene {
this.physics.add.overlap(this.player, this.platformManager.getEnemies(), this.handleEnemy, null, this);
this.cameras.main.setBounds(0, -999999, GAME_WIDTH, 999999 + GAME_HEIGHT);
this.cameras.main.startFollow(this.player, true, 0, 0.05, 0, 180);
// Manual upward-only follow: camera rises with player but never drops.
// Avoids lerp lag at high boost velocities that looked like FPS judder.
this.cameraOffsetY = 180;
this.cameras.main.setRoundPixels(false);
this.isGameOver = false;
this.isPaused = false;
@@ -83,7 +86,13 @@ export class GameScene extends Scene {
this.player.update(this.cursors, this.wasd, this.touchLeft, this.touchRight, time, delta);
this.bg.tilePositionY = this.cameras.main.scrollY * 0.3;
// Camera follow: instantly track player on the way up, never drop.
const targetY = this.player.y - GAME_HEIGHT / 2 + this.cameraOffsetY;
if (targetY < this.cameras.main.scrollY) {
this.cameras.main.scrollY = targetY;
}
this.bg.tilePositionY = Math.round(this.cameras.main.scrollY * 0.3);
this.minScrollY = Math.min(this.minScrollY, this.cameras.main.scrollY);
const killLine = this.minScrollY + GAME_HEIGHT;