Create a complete, polished **Tetris-style falling-block puz...
Prompt
Create a complete, polished **Tetris-style falling-block puzzle game** from scratch. IN HTML The game should closely recreate the classic Tetris gameplay experience, but use original code, UI, sounds, and visual assets rather than copying copyrighted assets. ## Core Gameplay Create a rectangular playfield that is: - 10 blocks wide - 20 visible blocks tall - With extra hidden rows above the visible area for spawning pieces Include all 7 standard tetromino shapes: - I - J - L - O - S - T - Z Use a **7-bag randomizer**, meaning all 7 pieces appear once in a randomized order before another bag begins. Pieces should spawn near the top-center of the board. The player must be able to: - Move left - Move right - Soft drop - Hard drop - Rotate clockwise - Rotate counterclockwise - Hold a piece - See upcoming pieces ## Controls Default keyboard controls: - Left Arrow / A = Move left - Right Arrow / D = Move right - Down Arrow / S = Soft drop - Space = Hard drop - Up Arrow / X = Rotate clockwise - Z = Rotate counterclockwise - C / Shift = Hold piece - P / Escape = Pause Make controls easy to change later. ## Rotation System Implement a proper rotation system similar to modern guideline-style Tetris. Include: - Clockwise rotation - Counterclockwise rotation - Wall kicks - Floor kicks - Special handling for the I-piece - Rotation near other blocks Rotation should feel consistent and forgiving. ## Ghost Piece Display a transparent **ghost piece** showing where the current tetromino will land if hard-dropped. The ghost piece should: - Match the active piece's shape and rotation - Update instantly when the piece moves - Never interfere with collision detection ## Hold System Add a hold box. The player can store the current piece and swap it with the held piece. Rules: - Holding is allowed once per piece placement. - After locking a piece, hold becomes available again. - If no piece is currently held, the current piece enters hold and the next piece spawns. ## Next Queue Show at least the next **5 upcoming pieces**. The queue should update immediately whenever a new piece spawns. ## Collision Pieces must properly collide with: - Left wall - Right wall - Floor - Existing blocks Pieces must never overlap locked blocks. ## Locking A piece should lock when it reaches the floor or another block. Add a short **lock delay** so the player can still move or rotate the piece briefly before it locks. Moving or rotating during the lock delay may reset the timer, but limit excessive resets so the player cannot stall forever. ## Line Clearing When a horizontal row becomes completely filled: - Remove the row - Move every row above it down - Play a short animation - Award points Support clearing: - Single = 1 line - Double = 2 lines - Triple = 3 lines - Tetris = 4 lines ## T-Spins Detect: - T-Spin - T-Spin Single - T-Spin Double - T-Spin Triple If reasonable, also support T-Spin Minis. Show a short message when one occurs. ## Scoring Create a scoring system based on modern Tetris-style scoring. Reward: - Soft drops - Hard drops - Singles - Doubles - Triples - Tetrises - T-Spins - Back-to-back clears - Combos Display: - Score - Level - Lines cleared - Current combo - Back-to-back status ## Combo System Consecutive line clears should increase the combo counter. If the player places a piece without clearing a line, reset the combo. Display combo notifications such as: "2 COMBO" "3 COMBO" etc. ## Back-to-Back Reward difficult clears performed consecutively. Examples: - Tetris followed by Tetris - T-Spin followed by Tetris - T-Spin followed by T-Spin Show a "BACK-TO-BACK" notification when active. ## Levels Start at Level 1. Increase the level based on lines cleared. For example: - Every 10 lines = +1 level As the level increases: - Pieces fall faster - Gameplay becomes progressively harder Create a configurable gravity table so fall speed can easily be adjusted. ## Game Over The game ends if a new tetromino cannot spawn because the spawn area is blocked. When game over occurs: - Stop gameplay - Show final score - Show level reached - Show total lines - Show "GAME OVER" - Add a Restart button - Allow Enter/R to restart ## UI Layout Create a clean modern interface. Suggested layout: Left side: - Hold piece Center: - Main playfield Right side: - Next pieces - Score - Level - Lines - Combo Top or bottom: - Pause button - Settings button ## Visual Style Use a dark modern arcade aesthetic. The board should have: - Dark background - Subtle grid - Bright tetromino colors - Smooth animations - Clear block outlines Use distinct colors for each piece, for example: - I = cyan - J = blue - L = orange - O = yellow - S = green - T = purple - Z = red Use original graphics rather than copyrighted Tetris artwork or branding. Do not display the official Tetris logo. ## Animations Add subtle animations for: - Line clears - Hard drops - Piece locking - Score changes - Level increases - T-Spins - Combos - Game over Animations should make the game feel responsive without delaying gameplay. ## Sound Add optional sound effects for: - Move - Rotate - Hard drop - Piece lock - Line clear - Tetris - T-Spin - Combo - Level up - Game over Add separate sliders for: - Master volume - Music - Sound effects Allow sound to be muted. Use original or royalty-free audio. ## Pause Menu Pressing Escape/P should pause the game. The pause menu should contain: - Resume - Restart - Settings - Quit / Return to Menu Gameplay timers must stop while paused. ## Main Menu Create a main menu with: - Play - Settings - Controls - High Scores When Play is selected, start a new game. ## Settings Include options for: - Master volume - Music volume - SFX volume - Ghost piece on/off - Screen shake on/off - Grid visibility - Keybinds Save settings locally. ## High Scores Store local high scores. Save at least: - Score - Lines - Level - Date Display the top 10 scores. ## Code Architecture Do not put the entire game in one giant script. Organize the project cleanly into separate systems/classes/modules such as: - GameManager - Board - Tetromino - PieceController - InputManager - RotationSystem - RandomBag - HoldSystem - ScoreManager - LevelManager - AudioManager - UIManager - SaveManager Keep gameplay logic separate from rendering/UI logic when possible. Use clear variable names and comments. Avoid unnecessary duplication. ## Game State Create proper game states such as: - MainMenu - Playing - Paused - GameOver Only allow gameplay input while the game is in the Playing state. ## Important Gameplay Requirements The finished game must correctly support: 1. 7 tetrominoes 2. 7-bag randomizer 3. Piece movement 4. Soft drop 5. Hard drop 6. Clockwise rotation 7. Counterclockwise rotation 8. Wall kicks 9. Hold 10. Next queue 11. Ghost piece 12. Lock delay 13. Line clearing 14. Scoring 15. Levels 16. Increasing gravity 17. Combos 18. Back-to-back clears 19. T-Spins 20. Pause 21. Restart 22. Game over 23. High scores 24. Settings 25. Customizable controls ## Development Process Build the game system-by-system rather than trying to create everything at once. Recommended order: 1. Create board/grid 2. Create tetromino data 3. Spawn pieces 4. Add gravity 5. Add horizontal movement 6. Add collision detection 7. Add rotation 8. Add wall kicks 9. Add locking 10. Add line clearing 11. Add next queue 12. Add 7-bag 13. Add hold 14. Add ghost piece 15. Add scoring 16. Add levels 17. Add combos/back-to-back 18. Add T-Spins 19. Add UI 20. Add menus 21. Add settings 22. Add sounds/animations 23. Add saving/high scores 24. Polish and test everything ## Testing After implementing each major system, test it before moving on. Specifically test: - Pieces cannot leave the board - Pieces cannot overlap blocks - Rotation works beside walls - Rotation works near the floor - I-piece rotations work correctly - Hold cannot be spammed - Hard drop lands correctly - Ghost piece predicts the correct landing point - Full rows disappear correctly - Multiple rows clear correctly - Score calculation works - Combos reset correctly - Back-to-back works - T-Spins are detected correctly - Game over triggers correctly - Pause completely freezes the game - Restart fully resets the board and game state Fix bugs instead of working around them. ## Final Goal The final result should feel like a polished modern version of classic falling-block puzzle gameplay: - Fast - Responsive - Easy to understand - Difficult to master - Cleanly coded - Smooth at high levels - Fully playable from start to game over Prioritize accurate gameplay mechanics and responsiveness over unnecessary visual complexity.
A system prompt was added to support web rendering
Response not available