Skip to content
TheChatArchiveThe Chat Archive
Claudeclaude-opus-4-6· AnthropicHugging Face Arena WebDev Preferences (2026)

Code a game similar to mario (NES)

  1. User

    Code a game similar to mario (NES)

  2. Claude Assistant

    I'll create a Mario-style platformer game using React, Vite, and Tailwind CSS with HTML5 Canvas. This will include a playable character, platforms, enemies, coins, pipes, and classic Mario-style gameplay mechanics.

    Let me start by exploring the project structure:

    Now let me build the Mario-style game. I'll create the game engine with canvas rendering, physics, level design, enemies, coins, and classic platformer mechanics.

    First, let me update the HTML title and create all the game files:

    Now let me create the game constants and types:

    Now let me create the level data:

    Now let me create the renderer:

    Now let me create the audio manager:

    Now let me create the main game engine:

    Now let me create the main game component:

    Now update the App component:

    Now update the CSS to ensure proper styling:

    Let me build to check for errors:

    The build succeeded. Let me now check a few things and make some improvements. Let me verify the game plays correctly by reviewing the critical collision and rendering logic:

    The level looks good. Let me enhance the level layout to be more faithful to the original Mario 1-1, with better platform placement and more interesting gameplay. I'll also fix the player start position to ensure they start on solid ground:

    Now update the engine to match the 15-row level height (player starts at row 13, above ground at row 14):

    The player starts at y=13*TILE_SIZE which is row 13 (0-indexed). With the new level having ground at row 14, the player needs to be at row 13 (one tile above ground) minus the player height. Let me fix the player start position:

    Now let me also update the canvas height to match 15 rows:

    15 rows * 32px = 480px, which matches the canvas height perfectly. Good.

    Now let me also update the renderer to account for the 15-row layout. The background hills and bushes need to be relative to the bottom of the canvas:

    The bushes are positioned at CANVAS_HEIGHT - 48 which should be above the ground tiles. With ground at row 14 (y=448), and bushes at 480-48=432, that's at the ground level. Let me adjust so they appear just above ground tiles. The ground tile top is at row 14 * 32 = 448px. So bushes should be at y=448-16=432. CANVAS_HEIGHT-48 = 432 which is correct. Good.

    Let me also make the hills and bushes relative to the ground level properly. Actually these are drawn without camera transform, so they're parallax background elements. That's fine.

    Let me build and test:

    The build succeeds. Let me now refine the game to add some polish — better title screen rendering at the right ground position and proper handling of the dead state transition:

    The game looks solid. Let me also add some pipe decorations to the title screen and add a goomba walking on the title:

    The game builds successfully. Let me do a final review of the engine's dead state handling to make sure the game over / restart flow works properly:

    The flow looks good. Let me also add the dead status check in the Game component so the player sees the death animation properly:

    Everything looks good. The game loop handles all states properly. Let me verify one more important thing - the Game component properly renders game state during death (since playing status persists during death animation):

    During death, the gameStatus is still 'playing', so it will continue to update and render (showing the death animation). After 120 frames it either resets the level or shows game over. Perfect.

    The game is complete! Here's a summary of what was built:

    Super Pixel Bros - A Mario-style Platformer Game

    Features:

    • 🎮 Full platformer gameplay with running, jumping, and stomping enemies
    • 🗺️ Large scrolling level inspired by Super Mario Bros 1-1, with pipes, bricks, question blocks, and a castle at the end
    • 👾 Two enemy types: Goombas (brown, can be stomped) and Koopas (green turtles, worth more points)
    • 🪙 Collectible coins scattered throughout the level, plus coins from question blocks
    • ❓ Interactive blocks: Question blocks give coins, brick blocks can be broken by hitting from below
    • 🏁 Flag pole finish with height-based score bonus
    • 📊 HUD showing score, coins, world, time, and lives
    • 💀 Death/respawn system with 3 lives and game over screen
    • 🎉 Win screen with fireworks effect
    • 🔊 Retro sound effects using Web Audio API (jump, coin, stomp, brick break, death, win)
    • 📱 Mobile touch controls with virtual D-pad and action buttons
    • 🎨 NES-style pixel art graphics drawn with canvas (no image assets needed)
    • 🏔️ Parallax scrolling background with clouds, hills, and bushes
    • ⌨️ Multiple control schemes: Arrow keys, WASD, Space/Shift

    Controls:

    • ← → or A/D: Move left/right
    • Space, ��, or W: Jump
    • Shift: Run faster
    • Enter: Start game / Restart

    Files built: index.html, src/game/constants.ts, src/game/types.ts, src/game/level.ts, src/game/renderer.ts, src/game/audio.ts, src/game/engine.ts, src/game/Game.tsx, src/App.tsx, src/index.css

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.