From 0020199bdee42528d25a71f4a80f07eb08eae600 Mon Sep 17 00:00:00 2001 From: Joey Wunderlich Date: Thu, 14 Dec 2023 11:56:46 -0800 Subject: [PATCH] fix camera stuttering on following on size sprite --- libs/game/camera.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/game/camera.ts b/libs/game/camera.ts index d7a3c746d..c89fb7fe2 100644 --- a/libs/game/camera.ts +++ b/libs/game/camera.ts @@ -86,8 +86,8 @@ namespace scene { if (this.sprite) { this._lastUpdatedSpriteX = this.sprite.x; this._lastUpdatedSpriteY = this.sprite.y; - this.offsetX = this.sprite.x - (screen.width >> 1); - this.offsetY = this.sprite.y - (screen.height >> 1); + this.offsetX = this.sprite.left + (this.sprite.width >> 1) - (screen.width >> 1); + this.offsetY = this.sprite.top + (this.sprite.width >> 1) - (screen.height >> 1); } this.drawOffsetX = this.offsetX;