debug: revert speed to 5 FPS and add console.log for food/score tracking

- Reset INITIAL_FPS from 12 back to 5 for easier debugging
- Change FOODS_PER_LEVEL to 1 for easier threshold testing
- Add console.log to track foods eaten, level ups, and score changes
- Logs show: foods eaten, will level up flag, current level, score additions
- This will help debug the score calculation logic
This commit is contained in:
2025-10-30 23:06:04 +00:00
parent 01526b8cd8
commit c3ed497392
+7 -2
View File
@@ -4,8 +4,8 @@ import type { UseBoardType } from "../useBoard";
import type { UseCursorType } from "../useCursor";
import type { UseFoodType } from "../useGame/useFood";
const INITIAL_FPS = 12;
const FOODS_PER_LEVEL = 2;
const INITIAL_FPS = 5;
const FOODS_PER_LEVEL = 1;
export function useGameStatus(
boardManager: UseBoardType,
@@ -92,6 +92,8 @@ export function useGameStatus(
foodsEatenRef.current += 1;
console.log(`[FOOD] Eaten: ${foodsEatenRef.current}, Will Level Up: ${willLevelUp}, Current Level: ${levelRef.current}`);
setScore((prev) => {
// Add points at CURRENT level
let newScore = prev + levelRef.current;
@@ -103,8 +105,11 @@ export function useGameStatus(
setLevel(newLevel);
currentFpsRef.current = INITIAL_FPS + (newLevel - 1);
foodsEatenRef.current = 0;
console.log(`[LEVELUP] New Level: ${newLevel}`);
}
console.log(`[SCORE] Adding ${levelRef.current} points, Total: ${newScore}`);
foodManagerRef.current.spawnFood(
snakeManagerRef.current.snakeBodyRef.current,
1