8-bit Brick Breaker 404
8bitcn/not-found-brick-breakerFreeBlock
A playable brick-breaker 404 page with keyboard, pointer, and touch controls.
Install it
npx shadcn@latest add https://www.8bitcn.com/r/not-found-brick-breaker.jsonSource
1"use client";23import Link from "next/link";4import {5 type KeyboardEvent,6 type PointerEvent as ReactPointerEvent,7 useCallback,8 useEffect,9 useId,10 useRef,11 useState,12} from "react";1314import { Badge } from "@/components/ui/8bit/badge";15import { Button } from "@/components/ui/8bit/button";16import {17 Card,18 CardContent,19 CardFooter,20 CardHeader,21} from "@/components/ui/8bit/card";22import { Kbd, KbdGroup } from "@/components/ui/8bit/kbd";23import {24 advanceBrickBreaker,25 BRICK_BREAKER_BOARD_HEIGHT,26 BRICK_BREAKER_BOARD_WIDTH,27 BRICK_BREAKER_FIXED_STEP,28 BRICK_BREAKER_MAX_FRAME_DELTA,29 type BrickBreakerEvent,30 type BrickBreakerInput,31 type BrickBreakerPhase,32 type BrickBreakerState,33 createBrickBreakerState,34 launchBrickBreakerBall,35 pauseBrickBreaker,36 restartBrickBreaker,37 resumeBrickBreaker,38 startBrickBreaker,39} from "@/lib/games/brick-breaker";40import { cn } from "@/lib/utils";4142import "@/components/ui/8bit/styles/retro.css";4344const MAX_PHYSICS_STEPS_PER_FRAME = 6;45const MAX_DEVICE_PIXEL_RATIO = 2;46const NON_REPEAT_KEYS = new Set([" ", "p", "escape", "r"]);47const MOVEMENT_KEYS: Readonly<Partial<Record<string, "left" | "right">>> = {48 a: "left",49 arrowleft: "left",50 arrowright: "right",51 d: "right",52};5354const PHASE_LABELS: Record<BrickBreakerPhase, string> = {55 idle: "WAITING",56 lost: "NO SIGNAL",57 paused: "PAUSED",58 playing: "PLAYING",59 ready: "READY",60 won: "ROUTE RESTORED",61};6263const ACTION_LABELS: Record<BrickBreakerPhase, string> = {64 idle: "START GAME",65 lost: "PLAY AGAIN",66 paused: "RESUME",67 playing: "PAUSE",68 ready: "LAUNCH",69 won: "PLAY AGAIN",70};7172interface BrickBreakerHud {73 lives: number;74 phase: BrickBreakerPhase;75 score: number;76}7778interface CanvasColors {79 accent: string;80 background: string;81 border: string;82 foreground: string;83 muted: string;84 primary: string;85 secondary: string;86}8788interface FrameAdvanceResult {89 accumulator: number;90 events: BrickBreakerEvent[];91}9293export interface NotFoundBrickBreakerProps94 extends React.ComponentPropsWithoutRef<"section"> {95 badge?: string;96 cta?: string;97 description?: string;98 href?: string;99 title?: string;100}101102function createInputState(): BrickBreakerInput {103 return {104 left: false,105 pointerX: null,106 right: false,107 };108}109110function createHud(state: BrickBreakerState): BrickBreakerHud {111 return {112 lives: state.lives,113 phase: state.phase,114 score: state.score,115 };116}117118function getCssColor(119 styles: CSSStyleDeclaration,120// … truncated
What it pulls in
Other registry items
Files it writes
More from 8bitcn
All 121 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| 8-bit Advanced 1advanced1 | 8bitcn | Blocks | Free | no deps · 3 files | |
| 8-bit Advanced 2advanced2 | 8bitcn | Blocks | Free | no deps · 5 files | |
| 8-bit Advanced 3advanced3 | 8bitcn | Blocks | Free | no deps · 6 files | |
| 8-bit Audio Settingsaudio-settings | 8bitcn | Blocks | Free | 2 deps · 7 files | |
| 8-bit Chapter Introchapter-intro | 8bitcn | Blocks | Free | no deps · 3 files | |
| 8-bit Character Sheetcharacter-sheet | 8bitcn | Blocks | Free | no deps · 9 files | |
| 8-bit Chartchart | 8bitcn | Blocks | Free | no deps · 3 files | |
| 8-bit Chart Area Stepchart-area-step | 8bitcn | Blocks | Free | no deps · 3 files |
