Fix game mode task cycling: Only end game on complete-all mode
Critical fix for timed and score target game modes: Issue: - Game was ending when all tasks were shown regardless of game mode - Timed and score target modes should continue cycling through tasks - Only 'complete-all' mode should end when all tasks are finished Fix: - Updated loadMainTask() to check gameMode before ending game - Complete-all mode: Ends game when all tasks completed (original behavior) - Timed/Score modes: Reset usedMainTasks array and continue cycling - Added console logging for task cycling in non-complete-all modes Now game modes work correctly: Complete All: Ends when all tasks finished Timed Challenge: Cycles through tasks until time runs out Score Target: Cycles through tasks until target score reached This enables proper infinite task cycling for time-based and score-based challenges!
This commit is contained in:
parent
cc853ad667
commit
ab26d61904
16
game.js
16
game.js
|
|
@ -2383,9 +2383,19 @@ ${usagePercent > 85 ? '⚠️ Storage getting full - consider deleting some imag
|
|||
);
|
||||
|
||||
if (availableTasks.length === 0) {
|
||||
// All main tasks completed - end game
|
||||
this.endGame();
|
||||
return;
|
||||
// All main tasks completed
|
||||
if (this.gameState.gameMode === 'complete-all') {
|
||||
// Only end game in complete-all mode
|
||||
this.endGame('complete-all');
|
||||
return;
|
||||
} else {
|
||||
// In timed and score-target modes, reset used tasks and continue
|
||||
console.log(`All tasks completed in ${this.gameState.gameMode} mode, cycling through tasks again`);
|
||||
this.gameState.usedMainTasks = [];
|
||||
// Recursively call loadMainTask to select from reset pool
|
||||
this.loadMainTask();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Select random task and random image from task pool
|
||||
|
|
|
|||
Loading…
Reference in New Issue