Commit Graph
51 Commits
Author SHA1 Message Date
pastilhas 80e011788d 0.6.0 2025-11-05 11:38:52 +00:00
pastilhas 812fd8f475 Fix text opacity and muting effect on multi-line paragraphs
- Set lineOpacity to 1.0 (full brightness) for all lines
- Remove opacity reduction based on line position
- Fix transition opacity recalculation that was dimming text
- Text now maintains full shine and vibrancy on all lines
2025-11-05 11:29:53 +00:00
pastilhas d7e8c0781f 0.5.0 2025-11-05 10:46:10 +00:00
pastilhas 04846be9e5 Move character input handling to game module
- Add keyboard handler for character input in useGame
- Character validation and typing now handled at module level
- platformHook focuses only on lifecycle: Space (start/restart), Escape (quit)
- Game module self-contained for core typing logic
2025-11-05 10:43:52 +00:00
pastilhas 5187e2e21e 0.4.0 2025-11-05 10:30:54 +00:00
pastilhas 4ed44fcadc Reduce downward speeds for sentences and paragraphs
- Sentences: 25 px/s → 20 px/s
- Paragraphs: 15 px/s → 10 px/s
2025-11-05 10:29:23 +00:00
pastilhas a3e7e83522 Use sequential selection for sentences and paragraphs instead of random
- Track sentenceIndex and paragraphIndex for sequential selection
- Sentences and paragraphs now appear in order, cycling through the list
- Letters and words remain randomized as before
2025-11-05 10:28:02 +00:00
pastilhas 961d86c035 Implement dynamic paragraph line splitting and fix line break detection
- Add calculateLineCount() to determine optimal lines based on text length (2-6 lines)
- Add getPerspectiveFactors() for appropriate perspective scaling per line count
- Replace hardcoded 6-line paragraphs with dynamic line calculation in both rendering and game logic
- Fix line break detection in useGameStatus to match rendering calculations exactly
- Extend keybindings to support all special characters: apostrophe, hyphen, colon, semicolon, quotes, parentheses, slash, ampersand, and digits
- Integrate greatFallsParagraphs content as wordList in paragraph mode
- Fix vertical centering to scale properly for variable line counts
2025-11-05 10:26:45 +00:00
pastilhas f8956dde6b 0.3.0 2025-11-05 09:16:56 +00:00
pastilhas db7e7bbd45 Change sentences and paragraphs spawn position to 0px (top of screen) 2025-11-05 09:14:24 +00:00
pastilhas 81e7bc756d Make sentences and paragraphs spawn offscreen from top for smoother entrance 2025-11-05 09:12:40 +00:00
pastilhas 469242690b Rename game to 'The Last StarTyper' throughout codebase 2025-11-04 21:56:21 +00:00
pastilhas 0e59c0c44b Prepare for npm publication: update gameInfo, package.json metadata, and add comprehensive README 2025-11-04 21:37:19 +00:00
pastilhas ccaedd6005 Fix useStateMachine dependency array reference error 2025-11-04 21:31:54 +00:00
pastilhas 5ca4825409 Clean up old unused files from example/src 2025-11-04 21:30:57 +00:00
pastilhas 52be880f49 Extract state machine logic into dedicated hook and move test scenarios to usePlatformHook 2025-11-04 21:28:23 +00:00
pastilhas bd3555e175 Reorganize example: move key bindings to usePlatformHook module 2025-11-04 21:22:53 +00:00
pastilhas 62c0eb8b71 Add score-based transitions and fix mode switching to prevent cascading and visual glitches 2025-11-04 21:15:58 +00:00
pastilhas 598c39e24a Add test state machines and fix mode tracking for correct threshold detection 2025-11-04 20:46:13 +00:00
pastilhas c147fd42d2 Track content completion per mode independently, preserving history across switches 2025-11-04 20:24:24 +00:00
pastilhas 157e2a71f4 Implement platform-controlled GameOptions for complete game behavior customization
- Add GameOptions with gameMode, downwardSpeed, boardDimensions, and wordList
- Platform now controls ALL game behavior through options
- changeGameMode now accepts full GameOptions instead of just mode
- downwardSpeed as single px/s value applies to any mode
- wordList is mode-agnostic, platform provides what they need
- All options are fully optional with sensible defaults
- Update example app to use new options API
2025-11-04 19:56:25 +00:00
pastilhas 2944d43c4a Fix ship explosion rendering by passing state through game loop
- Ship explosion now renders correctly when text reaches spaceship
- Pass shipState and shipExplosionTime through game loop callback for immediate updates
- Use refs for ship state to ensure real-time updates in rendering pipeline
- Remove debug console logging
- Ship explosion effect now displays all particles, fragments, and flash animations
2025-11-04 18:51:52 +00:00
pastilhas 3e985efb37 Fix ship explosion rendering issue
- Fixed ship state check to use parameter directly instead of ref
- Properly handle explosion time fallback when undefined
- Ship explosion now correctly renders when collision occurs
2025-11-04 18:37:03 +00:00
pastilhas 175d7ec692 Add dramatic ship explosion effect on death
- Ship now breaks into fragments that fly apart on explosion
- Added bright central flash that fades out
- Ship wings rotate and fly off in different directions
- Cockpit fragment flies upward while shrinking
- Added debris particles and sparks with physics
- Smoke trail effect appears after initial explosion
- Extended animation to 500ms for more dramatic effect
- Multiple layers: flash, fragments, debris, sparks, and smoke
2025-11-04 18:33:21 +00:00
pastilhas 8693c3bee2 Add paragraph line transitions and fix death detection for all modes
- Implemented line-by-line explosions for paragraph mode
- Lines explode when completed and remaining lines grow/shift down smoothly
- Fixed death detection: now properly calculates text bottom position for each mode
- Death triggers when bottom of text (not center) reaches top of spaceship
- Works correctly for words, sentences, and paragraphs (multi-line modes)
2025-11-04 18:27:52 +00:00
pastilhas ca0f20c5ca Fix paragraph line order and remove red text effect on misses
- Fixed paragraph display: first typed line now correctly appears at bottom, matching the Star Wars text crawl effect
- Removed red text flash when typing incorrectly - only red laser effect remains for visual feedback
- Adjusted perspective factors to properly scale lines from bottom (largest) to top (smallest)
- Clean up: removed all 'wrong' state handling from both rendering and game logic
2025-11-04 18:13:18 +00:00
pastilhas 8d093f2c85 feat: add laser shooting effects and ship tracking for words mode
- Add green lasers that hit target on correct typing
- Add red lasers that miss (left/right) on incorrect typing
- Implement laser beam visual with gradient and glow effects
- Add impact burst animation at laser end point
- Ship now tracks each character in words mode
- Creates dynamic targeting system for all game modes
2025-11-04 17:57:24 +00:00
pastilhas 7860c7e729 feat: add dynamic ship tracking for sentences mode
- Ship now moves to center of each character as you type
- Calculate and store X position of current character during rendering
- Ship smoothly tracks typing progress across both lines
- Handles line transitions seamlessly
- Creates engaging targeting effect as ship 'shoots' each letter
2025-11-04 17:45:36 +00:00
pastilhas d1de98793a feat: complete sentences mode with Star Wars effect and line transitions
- Implement two-line layout with Star Wars perspective (top line 80% size)
- Add smooth line transition animation when first line completes
- First line explodes independently, second line grows and moves down
- Fix space handling at line breaks (space included in first line)
- Ship stays centered for sentences mode
- Support punctuation input (commas, periods, exclamation, question marks)
- Reduce font size to 20px for better readability
- Set falling speed to 25 pixels/second for sentences
2025-11-04 17:42:25 +00:00
pastilhas 9ed9a0510c feat: reduce font size and split sentences into two lines
- Reduce font size from 32px to 20px for sentences/paragraphs mode
- Add breakTextIntoLines helper to split sentences naturally at spaces
- Render sentences across two lines with proper color progression
- Add space character to allowed input regex
2025-11-04 17:14:58 +00:00
pastilhas c271d1c4bf fix: center text and ship for sentences mode
- Ensure ship moves to and stays at center (400px) during sentence mode
- Remove width constraint to allow full text centering calculation
- Always call moveTowardTarget to smoothly center the ship
- Remove unused MAX_TEXT_WIDTH constant
2025-11-04 17:08:34 +00:00
pastilhas 166ccd7783 feat: implement sentences mode with centered text and slower speed
- Set sentence fall speed to 25 pixels/second
- Replace sentences with longer, realistic ones including commas and punctuation
- Sentences always render centered on screen (80% max width constraint)
- Ship stays centered during sentence mode (no horizontal movement)
- Add punctuation support (. , ! ?) to keyboard input
- Disable auto-tracking for sentence/paragraph modes
2025-11-04 17:00:20 +00:00
pastilhas 68078e1ec7 level up 2025-11-04 00:32:00 +00:00
pastilhas 9037af2e31 feat: enable seamless game mode switching during active gameplay
- Remove quitGame() call from changeGameMode to allow continuous play
- Game now transitions between modes without stopping
- Add test case in example App to auto-switch from letters to words at score 10
2025-11-04 00:26:17 +00:00
pastilhas ab3a1e13cd fix: properly space multi-character words in canvas rendering
- Change textAlign from 'center' to 'left' to avoid overlapping segments
- Manually calculate centering by subtracting textWidth/2 from X position
- Apply centering calculation to all letter states (normal, wrong, exploding)
- Words now display with correct letter spacing while scrolling
2025-11-04 00:15:52 +00:00
pastilhas d918cb8d2a docs: add AGENTS.md with React 19 guidelines and debugging lessons 2025-11-04 00:11:33 +00:00
pastilhas 2795931d56 fix: prevent button focus from interfering with game controls when changing modes
- Add blur() to mode buttons to remove focus after clicking
- Add preventDefault() to space/escape handlers to stop button activation
- Fix stale closures in useKeyBindings by accessing gameManager directly
- Remove all useCallback hooks per React 19 best practices
- Remove function dependencies from useEffect hooks
2025-11-04 00:09:24 +00:00
pastilhas 308eafac62 fix: preserve gameStatus when switching game modes
- Stop passing gameMode as dependency to useGameStatus initialization
- Create useGameStatus once with default 'letters' mode
- Add setGameMode method to update mode via ref without recreating hook
- Update gameMode via effect in useGame when it changes
- Fixes issue where switching to letters mode and starting game would reset to waiting
2025-11-03 23:41:12 +00:00
pastilhas 662557c933 feat: implement game modes system with letters and words support
- Add GameMode type: 'letters' | 'words' | 'sentences' | 'paragraphs'
- Add gameMode option to GameOptions (defaults to 'letters')
- Create wordLists.ts with curated word lists for each mode
- Update FallingLetter type to track:
  - fullText: complete word/sentence/paragraph
  - charIndex: current character progress in word
- Modify word spawning to pick from mode-specific word list
- Update handleTypedLetter to support multi-character typed sequences:
  - Track progress through word (charIndex)
  - Advance to next character when correct
  - Show complete word only when fully typed
- Enhanced canvas rendering with color-coded progress:
  - Green: completed characters
  - Yellow: current character being typed
  - White: remaining characters
- Add mode selector buttons to example app
- Default to 'words' mode in example for testing
- Full TypeScript support for all modes
2025-11-03 23:10:00 +00:00
pastilhas 7ee42a8dc1 feat: implement complete score tracking system
- Track score (starts at 0)
- +1 score and +1 correct for each correct character typed
- -1 score and +1 missed for each wrong character typed
- +1 deaths for each collision with ship
- Score resets when game starts
- All metrics exposed through ScoreManager
- Updated example app UI with colorful scoreboard showing:
  - Time (gray)
  - Score (neutral)
  - Correct (green)
  - Missed (yellow)
  - Deaths (red)
  - Keystrokes (neutral)
- Uses grid layout for organized metric display
- Score cannot go below 0 (clamped to minimum)
2025-11-03 23:04:26 +00:00
pastilhas 08c2d40d23 feat: add collision detection between falling letters and ship
- Detect collisions when letters reach ship's Y position
- Both letter and ship explode with particle animations on collision
- Ship explosion displays expanding particles in yellow, orange, and red
- Letters explode with their existing animation system
- After collision, letters clear and new letter spawns automatically
- Game continues after collision (no game-over condition yet)
- Collision threshold tuned for reliable detection (30px from ship center)
- Added shipState tracking to GameStatusManager
- Ship position continuously synced during game loop
2025-11-03 22:57:41 +00:00
pastilhas d69a9a6cc9 fix: correct vite alias from vim-snake to typing-chud 2025-11-03 22:53:24 +00:00
pastilhas 32045c5473 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.
2025-11-03 22:38:10 +00:00
pastilhas 04332effa6 feat: redesign spaceship with retro arcade aesthetic
Replace simple geometric spaceship with detailed design featuring metallic
hull with 3D gradient effect, glowing cyan cockpit, extended wings with red
tips, animated engine glow, and triple exhaust flames. Remove debug console
logs from movement and rendering code.
2025-11-03 22:24:47 +00:00
pastilhas aff5ccecbf feat: implement pixel-based spaceship animation with 100ms movement duration
Refactor spaceship positioning from column-based to pixel-based coordinates
with time-based interpolation, enabling smooth animation to letter positions
in exactly 100ms regardless of distance. Fixes coordinate mismatch that
prevented spaceship from moving to spawned letters.
2025-11-03 22:22:11 +00:00
pastilhas 5a0d8b5221 feat: enforce one active letter at a time (character mode)
- Add MAX_ACTIVE_LETTERS constant set to 1
- Only spawn new letter if no letters are currently active
- Prepare for future game modes (word, sentence, paragraph)
- Change keybindings to use Escape instead of Q
2025-11-03 22:05:22 +00:00
pastilhas 0dc4ecde72 feat: implement falling letters spawning from top
- Letters spawn at random horizontal positions every 1 second
- Letters fall at 100px/second from top to bottom
- Random A-Z letters rendered in white monospace font
- Fix game loop to start properly when startGame called
- Remove letters that exit bottom of screen
2025-11-03 22:01:40 +00:00
pastilhas dce96b8453 feat: implement canvas-based rendering with geometric spaceship
- Replace DOM grid with HTML5 canvas (800x600)
- Draw spaceship as geometric shapes (triangle + window + flames)
- Green body, yellow window, orange flame trails
- Smooth pixel-based rendering instead of DOM elements
2025-11-03 21:53:42 +00:00
pastilhas fb79aa0229 refactor: simplify example app by moving renderBoard call into useGame
- Remove useMounted and manual renderBoard call from example App
- Call renderBoard from useGame useEffect on initialization
- Follow vim-maze pattern for cleaner example app
2025-11-03 21:46:42 +00:00
pastilhas c036dc372d 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
2025-11-03 21:41:26 +00:00