Back to Prompt Library
Games

Block Drop 2-Player

Competitive split-screen falling block game for two players with gamepad support

Guide

Block Drop 2-Player

Build a competitive split-screen falling block puzzle game for two players.

No Setup Required

This is a frontend-only game. Just run it and play with a friend!

Controls:

  • Player 1: WASD to move, Q/E to rotate

  • Player 2: Arrow keys to move, comma/period to rotate

  • Gamepads: Each connected controller controls one player
  • Final Prompt

    ### Purpose
    Build a competitive 2-player falling block puzzle game that runs in the browser.
    
    ### Game Design
    
    **Visual Style**
    - Clean, colorful block graphics
    - Split-screen layout: Player 1 on left, Player 2 on right
    - Each player has their own 10x20 grid
    - Ghost piece showing where block will land
    - Next piece preview for each player
    - Score and lines cleared displayed per player
    
    **Block Pieces (7 Shapes)**
    - I-piece (cyan): 4 blocks in a line
    - O-piece (yellow): 2x2 square
    - T-piece (purple): T-shape
    - S-piece (green): S-shape zigzag
    - Z-piece (red): Z-shape zigzag
    - J-piece (blue): J-shape
    - L-piece (orange): L-shape
    
    **Core Mechanics**
    - Blocks fall from top of grid
    - Player moves blocks left/right, rotates, and soft/hard drops
    - Completed horizontal lines clear and award points
    - Game speeds up as more lines are cleared
    - Game over when blocks stack to the top
    
    **Competitive Mechanic - Garbage Lines**
    - Clearing 2 lines: Send 1 garbage line to opponent
    - Clearing 3 lines: Send 2 garbage lines to opponent
    - Clearing 4 lines: Send 4 garbage lines to opponent
    - Garbage lines appear at bottom of opponent's grid with one random gap
    - Visual warning when garbage is incoming
    
    **Scoring**
    - 1 line: 100 points
    - 2 lines: 300 points
    - 3 lines: 500 points
    - 4 lines: 800 points
    - Bonus for back-to-back multi-line clears
    
    **Game Flow**
    - Start screen with "PRESS START" - shows controls for both players
    - Countdown "3, 2, 1, GO!" before match starts
    - Match ends when one player tops out
    - Winner announcement with final scores
    - "PLAY AGAIN" option
    
    ### Controls
    
    **Keyboard - Player 1 (Left Side)**
    - A/D: Move left/right
    - W: Rotate clockwise
    - S: Soft drop (faster fall)
    - Q: Rotate counter-clockwise
    - Space: Hard drop (instant)
    
    **Keyboard - Player 2 (Right Side)**
    - Left/Right arrows: Move left/right
    - Up arrow: Rotate clockwise
    - Down arrow: Soft drop
    - Period (.): Rotate counter-clockwise
    - Enter: Hard drop
    
    **Gamepad Support (IMPORTANT)**
    The entire game must be playable with gamepad controllers, including menus:
    - Use the Gamepad API: https://developer.mozilla.org/en-US/docs/Web/API/Gamepad_API
    - First connected gamepad = Player 1
    - Second connected gamepad = Player 2
    - D-pad or Left stick: Move piece left/right, soft drop (down)
    - A button (buttons[0]): Rotate clockwise
    - B button (buttons[1]): Rotate counter-clockwise
    - X button (buttons[2]): Hard drop
    - Start button (buttons[9]): Start game / Pause
    - A button on start screen: Ready up (both players must ready)
    - A button on game over: Play again
    - Show "P1 Gamepad Connected" / "P2 Gamepad Connected" messages
    - Poll gamepad state in game loop using `navigator.getGamepads()`
    
    ### Technical Notes
    - Use HTML5 Canvas for rendering
    - 60 FPS game loop with requestAnimationFrame
    - Independent game state for each player
    - Responsive canvas that scales to fit screen
    - No external dependencies needed
    AI-Powered App Builder | OptiDev