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:
+7
-1
@@ -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;
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
|
||||
Reference in New Issue
Block a user