require arms-out to unpause, fix score shifting from combo

Autopause now stays active until user raises arms (pos-center→ready
transition). Simply stepping back into frame keeps the game paused.

Score HUD stacked vertically — combo sits above score so it doesn't
shift the score horizontally when appearing/disappearing.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
main
name 2026-04-11 22:44:58 -07:00
parent 143faeb640
commit 2ac2584806
2 changed files with 14 additions and 18 deletions

View File

@ -50,15 +50,16 @@
.scoreHud {
display: flex;
align-items: baseline;
gap: 12px;
flex-direction: column;
align-items: center;
margin-bottom: 8px;
}
.comboValue {
font-size: 32px;
font-size: 24px;
color: #ff44aa;
text-shadow: 0 0 16px rgba(255, 68, 170, 0.6), 0 2px 4px rgba(0, 0, 0, 0.8);
min-height: 30px;
}
.scoreValue {

View File

@ -83,25 +83,22 @@ export function GamePage() {
prevCalibRef.current = calibrationStatus
}
// Auto-pause when user leaves frame, debounced resume
// Auto-pause when user leaves frame; require arms-out (pos-center→ready) to unpause
const [autoPaused, setAutoPaused] = useState(false)
const resumeTimerRef = useRef<number>(0)
const sawPosCenterRef = useRef(false)
useEffect(() => {
if (!gameStarted) return
if (calibrationStatus === 'paused' || calibrationStatus === 'framing') {
// Pause immediately
clearTimeout(resumeTimerRef.current)
if (!autoPaused) gameLog(`autoPause ON (calibration=${calibrationStatus})`)
setAutoPaused(true)
} else if (calibrationStatus === 'ready' && autoPaused) {
// Debounce resume: wait 500ms of stable 'ready' before unpausing
clearTimeout(resumeTimerRef.current)
resumeTimerRef.current = window.setTimeout(() => {
gameLog('autoPause OFF (stable ready)')
setAutoPaused(false)
}, 500)
sawPosCenterRef.current = false
} else if (calibrationStatus === 'pos-center') {
sawPosCenterRef.current = true
} else if (calibrationStatus === 'ready' && autoPaused && sawPosCenterRef.current) {
gameLog('autoPause OFF (arms raised)')
setAutoPaused(false)
sawPosCenterRef.current = false
}
return () => clearTimeout(resumeTimerRef.current)
}, [calibrationStatus, gameStarted, autoPaused])
// Score delta floater + combo
@ -192,9 +189,7 @@ export function GamePage() {
<div className="debug-status">
{calibrationStatus === 'framing'
? 'PAUSED — I can\'t see your feet! Step back.'
: calibrationStatus === 'paused'
? 'PAUSED — Raise your arms to continue!'
: 'Resuming...'}
: 'PAUSED — Raise your arms to continue!'}
</div>
)}