feat: add typing mechanics with visual feedback and safe margins

Implement core typing game mechanics with keyboard input handling. Correct
letters trigger explosion animation with radiating particles and spawn new
letter. Wrong letters flash red for immediate feedback. Add 50px margins on
both edges to prevent spaceship and letters from appearing at screen borders.
This commit is contained in:
2025-11-03 22:38:10 +00:00
parent 04332effa6
commit 32045c5473
6 changed files with 101 additions and 13 deletions
+7 -1
View File
@@ -19,11 +19,16 @@ export const getGamePhase = (status: GameStatus): GamePhase =>
// ============================================================================
export type PlayerPosition = { x: number }; // pixel position 0-800
export type LetterState = 'normal' | 'wrong' | 'exploding';
export type FallingLetter = {
id: string;
letter: string;
x: number; // 0-800 pixel position
y: number; // 0-600 pixel position
state: LetterState;
stateStartTime?: number; // For animation timing
};
// ============================================================================
@@ -126,7 +131,8 @@ export type GameManager = {
clearKeyLog: () => void;
getKeyLog: () => KeyLogEntry[];
// TODO: Add game-specific additions
// Game-specific
handleTypedLetter: (letter: string) => void;
};
// ============================================================================