vod jam and earl vod.atverkackt.de
4
fork

Configure Feed

Select the types of activity you want to include in your feed.

Show Continue for users who return and new game option

+33 -5
+14 -1
src/lib/game/IntroSequence.svelte
··· 1 1 <script lang="ts"> 2 2 let { 3 3 oncomplete, 4 + oncontinue, 4 5 oninteract, 6 + hasProgress = false, 5 7 }: { 6 8 oncomplete?: () => void; 9 + oncontinue?: () => void; 7 10 oninteract?: () => void; 11 + hasProgress?: boolean; 8 12 } = $props(); 9 13 10 14 /** ··· 330 334 <div class="starfield" style="background-image: url('/space.webp')"></div> 331 335 <img src="/sprites/ship/ship.webp" alt="Ship" class="title-ship" /> 332 336 <h1 class="title-heading"><span class="title-text-animated">VoD Jam</span></h1> 337 + {#if hasProgress} 338 + <button 339 + class="start-btn" 340 + onclick={(e) => { e.stopPropagation(); handleInteract(); oncontinue?.(); }} 341 + onkeydown={(e) => { e.stopPropagation(); if (e.code === 'Enter' || e.code === 'Space') { handleInteract(); oncontinue?.(); } }} 342 + > 343 + Continue 344 + </button> 345 + {/if} 333 346 <button 334 347 class="start-btn" 335 348 onclick={(e) => { e.stopPropagation(); startIntro(); }} 336 349 onkeydown={(e) => { e.stopPropagation(); if (e.code === 'Enter' || e.code === 'Space') startIntro(); }} 337 350 > 338 - Play Game 351 + {hasProgress ? 'New Game' : 'Play Game'} 339 352 </button> 340 353 </div> 341 354 {/if}
+19 -4
src/routes/+page.svelte
··· 72 72 let loading = $state(true); 73 73 let error = $state(''); 74 74 75 - let gameState: GameState = $state(restored?.collectedIds?.length ? 'playing' : 'intro'); 75 + let hasProgress = restored?.collectedIds?.length ? true : false; 76 + let gameState: GameState = $state('intro'); 76 77 let previousPlayState: GameState = $state('playing'); 77 78 let selectedPresent: WorldPresent | null = $state(null); 78 79 let focusVideoId: string | undefined = $state(undefined); ··· 80 81 // --- Collection state --- 81 82 let collectedIds: Set<string> = $state(new Set(restored?.collectedIds ?? [])); 82 83 let collectedPresentsCache: WorldPresent[] = $state(restored?.collectedPresents ?? []); 83 - let savedElapsed: number = restored?.timerElapsed ?? 0; 84 + let savedElapsed: number = $state(restored?.timerElapsed ?? 0); 84 85 let timerStartedAt: number | null = $state(null); 85 86 let timerEndedAt: number | null = $state(restored?.timerEnded ? 0 : null); 86 87 let lastPlayerPosition: { x: number; y: number } | null = $state(restored?.playerPosition ?? null); 87 - let initialPlayerPosition: { x: number; y: number } | null = restored?.playerPosition ?? null; 88 + let initialPlayerPosition: { x: number; y: number } | null = $state(restored?.playerPosition ?? null); 88 89 let timerPausedForVideo = false; 89 90 90 91 let elapsedMs = $derived( ··· 139 140 }); 140 141 141 142 function handleIntroComplete() { 143 + // Completed the full intro cutscene — reset any saved progress for a fresh start 144 + collectedIds = new Set(); 145 + collectedPresentsCache = []; 146 + savedElapsed = 0; 147 + timerStartedAt = null; 148 + timerEndedAt = null; 149 + lastPlayerPosition = null; 150 + initialPlayerPosition = null; 151 + localStorage.removeItem(STORAGE_KEY); 152 + gameState = 'playing'; 153 + playCorrectTrack(); 154 + } 155 + 156 + function handleContinue() { 142 157 gameState = 'playing'; 143 158 playCorrectTrack(); 144 159 } ··· 316 331 {:else} 317 332 <!-- Intro sequence --> 318 333 {#if gameState === 'intro'} 319 - <IntroSequence oncomplete={handleIntroComplete} oninteract={playCorrectTrack} /> 334 + <IntroSequence oncomplete={handleIntroComplete} oncontinue={handleContinue} oninteract={playCorrectTrack} {hasProgress} /> 320 335 {/if} 321 336 322 337 <!-- Game world (always rendered after videos load, hidden during intro) -->