server for auth, more goodies
This commit is contained in:
parent
f83bce8e2b
commit
7cebe39a14
7 changed files with 80 additions and 24 deletions
|
|
@ -89,8 +89,13 @@ function FallingWordsGame({ highScore, onGameOver }: Props) {
|
|||
const livesRef = useRef(5)
|
||||
const gameOverRef = useRef(false)
|
||||
|
||||
livesRef.current = lives
|
||||
gameOverRef.current = gameOver
|
||||
useEffect(() => {
|
||||
livesRef.current = lives
|
||||
}, [lives])
|
||||
|
||||
useEffect(() => {
|
||||
gameOverRef.current = gameOver
|
||||
}, [gameOver])
|
||||
|
||||
const spawnWord = useCallback(() => {
|
||||
const difficulty = difficultyRef.current
|
||||
|
|
|
|||
|
|
@ -811,7 +811,7 @@ export function MissileGame({ highScore, onGameOver }: Props) {
|
|||
}
|
||||
}
|
||||
// Wrong key: do nothing (no penalty for wrong chars, just no progress)
|
||||
}, [started, gameOver, startGame, triggerShake])
|
||||
}, [started, gameOver, startGame])
|
||||
|
||||
return (
|
||||
<div className="fade-in">
|
||||
|
|
|
|||
|
|
@ -26,7 +26,10 @@ export function useTypingEngine(
|
|||
const startTimeRef = useRef<number | null>(null)
|
||||
const [wpm, setWpm] = useState(0)
|
||||
const onCompleteRef = useRef(onComplete)
|
||||
onCompleteRef.current = onComplete
|
||||
|
||||
useEffect(() => {
|
||||
onCompleteRef.current = onComplete
|
||||
}, [onComplete])
|
||||
|
||||
const accuracy = totalKeystrokes > 0 ? Math.round((correctKeystrokes / totalKeystrokes) * 100) : 100
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue