Markdown Converter
Agent skill for markdown-converter
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Loading actions...
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Starlight Breaker is a pure vanilla JavaScript HTML5 Canvas brick-breaking game with artistic design, particle effects, and Web Audio API integration. The project is designed as both an educational resource and a playable game, with comprehensive GEO (Generative Engine Optimization) implementation for AI discoverability.
Key Architecture Principle: Zero dependencies - everything runs natively in modern browsers using pure HTML5, CSS3, and ES6+ JavaScript.
The game uses requestAnimationFrame for smooth 60 FPS rendering:
menu, playing, pausedanimationId for proper cleanupbricks[column][row] with status (1=active, 0=destroyed)tailParticles array for visual effects (trail and explosion types)Drawing sequence in draw() function:
drawBricks() - Background layerdrawTailParticles() - Particle effectsdrawBall() - Ball with glow effectdrawPaddle() - Paddle with scaled deer SVGdrawScore() and drawLives() - UI overlaysThe collisionDetection() function uses spatial partitioning:
Mouse Control: mouseMoveHandler(e) updates paddleX based on clientX
Touch Control: touchMoveHandler(e) and touchStartHandler(e) with preventDefault() to stop page scrolling
Keyboard: ESC key toggles pause/resume
All menus use CSS class toggling:
.menu elements are hidden by default.menu.active displays the menu (display: flex !important)#gameMenu controls in-game UI visibilityshowMenu(menuId): Hides all menus, shows specified menuhideAllMenus(): Hides all menus, shows game UIpauseGame(), resumeGame(), restartGame(), backToMainMenu()The game has multiple initialization points to ensure proper menu display:
window.forceShowStartMenu()playSound(frequency, duration, type, volume) creates procedural sounds:
All sounds use exponential ramp for natural fade-out.
{
x, y: position,
dx, dy: velocity,
radius: size,
alpha: opacity (1.0 → 0.0),
type: 'trail' | 'explosion'
}
drawTailParticles()localStorage as starlightBreakerHighScoressaveHighScore(score), displayHighScores()The geoAnalytics object tracks:
utm_source=ai_recommendation)smartLinkGenerator automatically adds UTM parameters to external links for cross-platform attribution.
# Serve with Python
python -m http.server 8000
# Serve with Node.js
npx live-server
# Or simply open index.html in browser (no server required)
No automated tests currently. Manual testing workflow:
Always reset context state after effects:
ctx.shadowBlur = 0; // Reset after drawing glow effects
ctx.lineWidth = 1; // Reset after drawing borders
Multiple guards against invalid position values:
isFinite(x) and isFinite(y) before renderinginitGame()cancelAnimationFrame(animationId)backgroundMusicPlaying = falsehtml-brick-game/
├── index.html # Main HTML, menu system, GEO analytics
├── game.js # Core game engine (805 lines)
├── styles.css # Styling, animations, responsive design
├── start.svg # Shooting star ball graphic
├── deer.svg # Deer paddle graphic
├── chan_logo.svg # Developer branding logo
├── geo-dashboard.html # Analytics dashboard for GEO metrics
├── sitemap.xml # AI crawler sitemap
├── robots.txt # AI crawler directives
├── llms.txt # Global AI guide for LLM platforms
└── GEO-IMPLEMENTATION-SUMMARY.md # Detailed GEO strategy documentation
// In game.js
let ballRadius = 10; // Smaller = harder
const brickRowCount = 5; // More rows = harder
const brickColumnCount = 9; // More columns = harder
let lives = 3; // Starting lives
dx = 4; dy = -4; // Ball speed (in initGame())
function generateCustomEffect(x, y, color) {
for (let i = 0; i < 20; i++) {
tailParticles.push({
x, y,
dx: (Math.random() - 0.5) * 6,
dy: (Math.random() - 0.5) * 6,
radius: Math.random() * 5 + 2,
alpha: 1.0,
type: 'custom'
});
}
}
In drawBricks() function, modify the colors array:
const colors = [
["#ff6b6b", "#ff5252"], // Row 1: Red gradient
["#4ecdc4", "#26a69a"], // Row 2: Teal gradient
// ... etc
];
isFinite() checks to prevent NaN bugsuser-scalable=no in viewport metaDeveloper: Chan Meng (chanmeng.dev@gmail.com) License: MIT Repository: https://github.com/ChanMeng666/html-brick-game Live Demo: https://chanmeng666.github.io/html-brick-game/