Doodle-jump camera and remove player shadow
- Camera now uses a trigger line at 42% from top. Player rises/falls freely below the line; camera only scrolls up past it, never down. - Remove playerShadow graphics that followed the hero around. - Ignore .vercel-cli-config (CLI auth cache used as Windows workaround).
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -35,3 +35,6 @@ rocket_preview.png
|
|||||||
|
|
||||||
# Agent notes — local only, useful for AI sessions but not for public repo
|
# Agent notes — local only, useful for AI sessions but not for public repo
|
||||||
AGENTS.md
|
AGENTS.md
|
||||||
|
|
||||||
|
# Vercel CLI auth cache (workaround for Windows EXDEV issue)
|
||||||
|
.vercel-cli-config/
|
||||||
|
|||||||
@@ -41,9 +41,6 @@ export class GameScene extends Scene {
|
|||||||
this.player = new Player(this, GAME_WIDTH / 2, startY - 140);
|
this.player = new Player(this, GAME_WIDTH / 2, startY - 140);
|
||||||
this.lastJumpY = this.player.y;
|
this.lastJumpY = this.player.y;
|
||||||
|
|
||||||
this.playerShadow = this.add.graphics();
|
|
||||||
this.playerShadow.setDepth(-4);
|
|
||||||
|
|
||||||
this.effects = new EffectsManager(this);
|
this.effects = new EffectsManager(this);
|
||||||
|
|
||||||
this.platformManager = new PlatformManager(this);
|
this.platformManager = new PlatformManager(this);
|
||||||
@@ -60,9 +57,9 @@ export class GameScene extends Scene {
|
|||||||
this.physics.add.overlap(this.player, this.platformManager.getEnemies(), this.handleEnemy, null, this);
|
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.setBounds(0, -999999, GAME_WIDTH, 999999 + GAME_HEIGHT);
|
||||||
// Manual upward-only follow: camera rises with player but never drops.
|
// Doodle-jump camera: free movement below the trigger line, camera only
|
||||||
// Avoids lerp lag at high boost velocities that looked like FPS judder.
|
// scrolls up when player rises above it, and never moves down.
|
||||||
this.cameraOffsetY = 180;
|
this.cameraTriggerY = GAME_HEIGHT * 0.42; // ~358 of 854 (just above middle)
|
||||||
this.cameras.main.setRoundPixels(false);
|
this.cameras.main.setRoundPixels(false);
|
||||||
|
|
||||||
this.isGameOver = false;
|
this.isGameOver = false;
|
||||||
@@ -86,10 +83,10 @@ export class GameScene extends Scene {
|
|||||||
|
|
||||||
this.player.update(this.cursors, this.wasd, this.touchLeft, this.touchRight, time, delta);
|
this.player.update(this.cursors, this.wasd, this.touchLeft, this.touchRight, time, delta);
|
||||||
|
|
||||||
// Camera follow: instantly track player on the way up, never drop.
|
// Camera: latch player at trigger line going up, free movement otherwise.
|
||||||
const targetY = this.player.y - GAME_HEIGHT / 2 + this.cameraOffsetY;
|
const targetScrollY = this.player.y - this.cameraTriggerY;
|
||||||
if (targetY < this.cameras.main.scrollY) {
|
if (targetScrollY < this.cameras.main.scrollY) {
|
||||||
this.cameras.main.scrollY = targetY;
|
this.cameras.main.scrollY = targetScrollY;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.bg.tilePositionY = Math.round(this.cameras.main.scrollY * 0.3);
|
this.bg.tilePositionY = Math.round(this.cameras.main.scrollY * 0.3);
|
||||||
@@ -116,18 +113,9 @@ export class GameScene extends Scene {
|
|||||||
this.lastJumpY = this.player.y;
|
this.lastJumpY = this.player.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.updatePlayerShadow();
|
|
||||||
this.effects.update(this.player, delta);
|
this.effects.update(this.player, delta);
|
||||||
}
|
}
|
||||||
|
|
||||||
updatePlayerShadow() {
|
|
||||||
this.playerShadow.clear();
|
|
||||||
if (!this.player.active) return;
|
|
||||||
const alpha = Math.max(0.05, 0.25 - (Math.abs(this.player.body.velocity.y) / 1200));
|
|
||||||
this.playerShadow.fillStyle(0x000000, alpha);
|
|
||||||
this.playerShadow.fillCircle(this.player.x, this.player.y + 42, 16);
|
|
||||||
}
|
|
||||||
|
|
||||||
platformCollisionFilter(player, platform) {
|
platformCollisionFilter(player, platform) {
|
||||||
if (!platform || !platform.body) return false;
|
if (!platform || !platform.body) return false;
|
||||||
if (typeof platform.isBroken === 'function' && platform.isBroken()) return false;
|
if (typeof platform.isBroken === 'function' && platform.isBroken()) return false;
|
||||||
|
|||||||
Reference in New Issue
Block a user