feat: implement game board rendering and spaceship player control

- Create 10x20 game board grid with retro styling
- Render spaceship emoji at player position (bottom center)
- Implement cursor movement with hjkl (left/right only)
- Add moveToStart (0) and moveToEnd ($) anchor motions
- Re-render board when cursor position changes
- Board displays dark grid with highlighted player row
This commit is contained in:
2025-11-03 21:41:26 +00:00
parent 80f7aa3f8a
commit c036dc372d
5 changed files with 95 additions and 26 deletions
+9 -5
View File
@@ -15,10 +15,16 @@ export const getGamePhase = (status: GameStatus): GamePhase =>
status === 'waiting' ? 'idle' : 'playing';
// ============================================================================
// Game-Specific Types (to be defined)
// Game-Specific Types
// ============================================================================
// TODO: Define game-specific types here
export type PlayerPosition = { x: number }; // 0-9 for 10 columns
export type Word = {
id: string;
text: string;
x: number; // 0-9 column position
y: number; // vertical position (0 = top, increases downward)
};
// ============================================================================
// Input & Key Tracking
@@ -45,10 +51,8 @@ export type BoardManager = {
export type CursorMode = 'normal';
export type Coord = { row: number; col: number };
export type CursorManager = {
position: () => Coord;
position: () => PlayerPosition;
mode: () => CursorMode;
// VIM-style motions (required by Unified API)