Commit Graph

4 Commits

Author SHA1 Message Date
Dabit
398bc4a20e feat(02-01): add AI module and extend Physics for paddle2 movement and collision
- Add AI object with init(), update(), _predictBallY() methods
- AI uses predictive ray-cast with wall bounce simulation to intercept ball
- AI respects difficulty config (speed, reactionDelay, errorMargin) from GameConfig
- Add Physics._checkPaddle2Collision() with 5-zone deflection, ball goes LEFT
- Extend Physics.update() with paddle2 movement branch (2p/ai modes)
- Add AI.init() to initialization block
2026-03-10 21:06:07 +01:00
Dabit
a2f0bc391b feat(02-01): extend GameConfig, GameState, and Input for two-player support
- Add WIN_SCORE, AI_EASY, AI_MEDIUM, AI_HARD to GameConfig
- Add paddle2, score1, score2, mode, difficulty, gameState, winner to GameState
- Replace anonymous Input handlers with named refs + cleanup() method
- Add Input.getVerticalInput2() for ArrowUp/ArrowDown keys
- Position paddle2 on right side in Physics.init()
- Update Physics.onResize() to call init() for full repositioning
2026-03-10 21:05:13 +01:00
Dabit
46b8f7bcc7 feat(01-02): add ball physics — movement, wall bounce, zone deflection, and GameConfig
- Add GameConfig with initialBallSpeed (220px/s), speedIncrement (18px/s), paddleSpeed (400px/s)
- Add Physics.serveBall(): centers ball, sets random angle (-45 to +45 deg), random left/right dir
- Replace Physics.update() skeleton with full ball movement and wall bounce logic
- Add Physics._checkPaddleCollision() with 5-zone angle deflection and speed increment per hit
- Ball exits left/right bounds → immediate re-serve from center
- Ball pushed out of paddle on collision to prevent double-hit next frame
- Add on-canvas speed debug display (Phase 1 verification aid)
2026-03-10 14:50:41 +01:00
Dabit
e43b82b4cb feat(01-01): HTML scaffold with HiDPI canvas, Renderer, and full-window layout
- Created index.html with valid HTML5 structure and black full-window canvas
- Renderer object with devicePixelRatio-aware resize() using logical vs bitmap coords
- CSS enforces overflow:hidden with no scrollbars
- Minimum 4:3 aspect ratio enforcement in resize logic
- window.addEventListener('resize') handler for live canvas rescaling
2026-03-10 14:46:17 +01:00