From c3ed49739227263ea9fc24bc1c07d8ebd735fe8e Mon Sep 17 00:00:00 2001 From: Andre Padez Date: Thu, 30 Oct 2025 23:06:04 +0000 Subject: [PATCH] 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 --- src/useGameStatus/useGameStatus.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/useGameStatus/useGameStatus.ts b/src/useGameStatus/useGameStatus.ts index c90343e..123ef00 100755 --- a/src/useGameStatus/useGameStatus.ts +++ b/src/useGameStatus/useGameStatus.ts @@ -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