Skip to content

Comments

Refactor: React 18 + TypeScript + Tailwind + Vite#21

Open
balajmarius wants to merge 2 commits intomasterfrom
refactor/react-typescript-vite
Open

Refactor: React 18 + TypeScript + Tailwind + Vite#21
balajmarius wants to merge 2 commits intomasterfrom
refactor/react-typescript-vite

Conversation

@balajmarius
Copy link
Owner

@balajmarius balajmarius commented Feb 20, 2026

Summary

  • Ground-up rewrite replacing Phaser 2.6.2 + ES2015 + FuseBox with React 18, TypeScript, Tailwind CSS 3, and Vite 5
  • All game logic in a pure useReducer — no framework, no canvas, just CSS sprite rendering via background-position on divs
  • Pixel-exact sprite positions and timing constants migrated from original config.js + levels.js

What changed

  • Types: GamePhase, GameState, and all sub-state interfaces in src/types/
  • Reducer: Single gameReducer.ts handles TICK (rAF-driven), FIRE, MOVE, collision detection, bug spawning/advancing, difficulty scaling
  • Hooks: useGameLoop (rAF), useKeyboard, useAudio (pooled Audio elements), useAssetLoader, useSoundEffects (state-diff based)
  • Components: 13 components — leaf sprites (Bug, Bullet, Octocat) wrapped in React.memo, containers (BugColumn, BulletColumn, layers), and shell (ArcadeCabinet, Loader, GameScreen)
  • Removed: Phaser CDN dependency, FuseBox bundler, Babel, old ESLint config

Claude Code session

https://claudebin.com/threads/zR4hf854E0

Test plan

  • npm run dev → game loads, LCD cabinet visible with scanline overlay
  • Press Enter → game starts, Octocat visible in column 0
  • Arrow keys → Octocat moves between 4 columns with press sound
  • Spacebar → bullet fires upward from current column
  • Bugs spawn and descend at 500ms intervals
  • Bullet hitting bug → explosion + score increment + explode sound
  • Score reaching 25/50/100/150 → bug speed increases
  • Bug reaching bottom → player dies, die sound, game over
  • Enter after death → full restart

🤖 Generated with Claude Code

balajmarius and others added 2 commits February 20, 2026 15:49
Replace Phaser 2.6.2 + ES2015 + FuseBox with a modern React stack.
All game logic lives in a pure reducer with rAF-driven ticks, sprite
rendering via CSS background-position on divs, and sound effects
triggered by state diffs.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Old src/ (actors, helpers, shared, states, main.js) and static/
directory are superseded by the React rewrite. Assets now live
in public/assets/.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant