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:
@@ -4,8 +4,8 @@ import type { UseBoardType } from "../useBoard";
|
|||||||
import type { UseCursorType } from "../useCursor";
|
import type { UseCursorType } from "../useCursor";
|
||||||
import type { UseFoodType } from "../useGame/useFood";
|
import type { UseFoodType } from "../useGame/useFood";
|
||||||
|
|
||||||
const INITIAL_FPS = 12;
|
const INITIAL_FPS = 5;
|
||||||
const FOODS_PER_LEVEL = 2;
|
const FOODS_PER_LEVEL = 1;
|
||||||
|
|
||||||
export function useGameStatus(
|
export function useGameStatus(
|
||||||
boardManager: UseBoardType,
|
boardManager: UseBoardType,
|
||||||
@@ -92,6 +92,8 @@ export function useGameStatus(
|
|||||||
|
|
||||||
foodsEatenRef.current += 1;
|
foodsEatenRef.current += 1;
|
||||||
|
|
||||||
|
console.log(`[FOOD] Eaten: ${foodsEatenRef.current}, Will Level Up: ${willLevelUp}, Current Level: ${levelRef.current}`);
|
||||||
|
|
||||||
setScore((prev) => {
|
setScore((prev) => {
|
||||||
// Add points at CURRENT level
|
// Add points at CURRENT level
|
||||||
let newScore = prev + levelRef.current;
|
let newScore = prev + levelRef.current;
|
||||||
@@ -103,8 +105,11 @@ export function useGameStatus(
|
|||||||
setLevel(newLevel);
|
setLevel(newLevel);
|
||||||
currentFpsRef.current = INITIAL_FPS + (newLevel - 1);
|
currentFpsRef.current = INITIAL_FPS + (newLevel - 1);
|
||||||
foodsEatenRef.current = 0;
|
foodsEatenRef.current = 0;
|
||||||
|
console.log(`[LEVELUP] New Level: ${newLevel}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log(`[SCORE] Adding ${levelRef.current} points, Total: ${newScore}`);
|
||||||
|
|
||||||
foodManagerRef.current.spawnFood(
|
foodManagerRef.current.spawnFood(
|
||||||
snakeManagerRef.current.snakeBodyRef.current,
|
snakeManagerRef.current.snakeBodyRef.current,
|
||||||
1
|
1
|
||||||
|
|||||||
Reference in New Issue
Block a user