From 4dd2a839f493d1e820e4ec957dcdcc4be67e48f8 Mon Sep 17 00:00:00 2001 From: "Z. Cliffe Schreuders" Date: Fri, 7 Nov 2025 20:37:27 +0000 Subject: [PATCH] Enhance PersonChatUI to track characters with parallax animation - Introduced a Set to keep track of characters that have undergone parallax animation, ensuring that the animation resets only for new speakers. - Updated the logic to conditionally reset the parallax animation based on whether the speaker has been seen before, improving visual continuity during conversations. --- js/minigames/person-chat/person-chat-ui.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/js/minigames/person-chat/person-chat-ui.js b/js/minigames/person-chat/person-chat-ui.js index dea3f26..eddba9d 100644 --- a/js/minigames/person-chat/person-chat-ui.js +++ b/js/minigames/person-chat/person-chat-ui.js @@ -52,6 +52,7 @@ export default class PersonChatUI { // State this.currentSpeaker = null; // Character ID this.hasContinued = false; // Track if user has clicked continue + this.charactersWithParallax = new Set(); // Track which characters have already had parallax animation console.log('📱 PersonChatUI created'); } @@ -289,9 +290,11 @@ export default class PersonChatUI { this.portraitRenderer.setupSpriteInfo(); - // Reset parallax animation for new speaker - if (this.portraitRenderer.backgroundImage) { + // Reset parallax animation only for characters we haven't seen before + const speakerId = characterId || character.id; + if (this.portraitRenderer.backgroundImage && !this.charactersWithParallax.has(speakerId)) { this.portraitRenderer.resetParallaxAnimation(); + this.charactersWithParallax.add(speakerId); } this.portraitRenderer.render();