King of Math - Mathematical Tower Defense Game

Seele01-Flash
By
King of Math is an innovative tower defense puzzle game that combines mathematical problem-solving with strategic castle defense. Defeat zombie hordes by solving math equations while protecting your kingdom.

Prompt

MODEL: Seele01-Flash
Please use Three.js to generate a **mobile-first game** with the theme "**King of Math: Low-Poly Tower Defense**". Please read the following detailed game design requirements first, and then generate the code accordingly: ### 1. Assets & Environment * **Visual Style:** A stylized **Low-Poly / Toon-shaded** aesthetic. Use vibrant, saturated colors to appeal to casual players. The scene should render in a **2.5D side-scrolling perspective** (camera fixed at a slight angle, looking at the scene from the side). * **Environment:** * **Left Side:** A spawning ground (dark forest edge or graveyard mist). * **Right Side:** A fortified wooden castle wall with a tower. On the tower, place a simple geometric representation of a "Wizard" (e.g., a blue cone hat, staff) and a "King". * **Background:** Simple layered mountains or trees (parallax effect if possible) to add depth. * **Ground:** Green grassy texture with a dirt path running from left to right. * **Characters & Effects:** * **Enemies (Zombies):** Green, blocky, low-poly humanoid figures. Use `THREE.InstancedMesh` for performance to handle multiple zombies on screen simultaneously. * **Projectiles:** Glowing blue spheres or jagged "Lightning" lines (using `THREE.Line` or glowing particles) that shoot from the Wizard to the zombies. * **UI Overlay:** A clean, floating text billboard above the Wizard displaying the current Math Problem (e.g., "5 + 7 = ?"). * **Mobile Optimization:** Limit the polygon count. Use simple Lambert or Basic materials. Shadows should be static or baked if possible; otherwise, use a single directional light. ### 2. Audio Requirements * **BGM:** A fast-paced, whimsical "Medieval Battle" track. It should be looping and energetic (marching drums, light flutes). * **Sound Effects (SFX):** * **Correct Answer:** A sharp electric "Zap" or "Magic Chime" sound. * **Wrong Answer:** A low-pitch "Buzzer" or "Dud" sound. * **Zombie Spawn:** Soft shuffling or light growling (non-scary). * **Impact:** A "Thud" when a zombie hits the castle wall. ### 3. Gameplay Loop * **Core Mechanic:** Zombies spawn on the left and move towards the right at varying speeds. A global "Current Math Equation" is displayed at the top center or above the castle. * **Combat Logic:** * The player must solve the equation to attack. * **Correct Answer:** The Wizard shoots a lightning bolt that instantly destroys the **closest** zombie. A new equation is immediately generated. * **Wrong Answer:** The screen flashes red, and the player is locked out of input for 0.5 seconds (penalty). * **Win/Loss Conditions:** * **Health:** The castle has 3 Hearts (Lives). If a zombie reaches the wall, -1 Heart. * **Score:** +10 points for every correct answer. * **Progression:** As the score increases, the math problems become slightly harder (addition -> subtraction -> multiplication) and zombies move faster. ### 4. Mobile Controls & Interaction * **Orientation:** **Landscape Mode** is mandatory for the side-scrolling view. * **Input Method (The "Math Pad"):** * Create a custom **HTML/CSS UI Overlay** at the bottom of the screen. * Do **not** use the native mobile keyboard (it blocks the view). * Design a large **Numeric Keypad** on the right or bottom center (Buttons 0-9, 'C' for Clear, 'Enter' or auto-submit). * Buttons must be at least **44x44 pixels** (ideally larger) with high contrast for touch accessibility. * **Feedback:** * **Haptic Feedback:** Trigger `navigator.vibrate(50)` on a wrong answer or when taking damage. * **Visual Feedback:** Floating damage numbers or particle explosions when a zombie is destroyed. Shake the camera slightly when the wall is hit. Do not ask for clarification. Do not request confirmation. Directly execute the generation task based on the given instructions.

Game Introduction

About King of Math

King of Math is a unique educational tower defense game that transforms mathematical learning into an exciting zombie-fighting adventure. With a 3.2/5 rating, this game successfully blends puzzle-solving mechanics with strategic gameplay, creating an engaging experience that sharpens your math skills while defending your medieval castle from relentless zombie attacks.

Core Features

Educational Gaming Excellence

  • Math-Based Combat System : Solve arithmetic problems to launch attacks against zombies
  • Progressive Difficulty : Math challenges increase in complexity as you advance
  • Multiple Mathematical Operations : Addition, subtraction, multiplication, and division problems
  • Real-Time Strategy Elements : Plan your mathematical solutions while zombies approach
  • Visual Learning : Colorful medieval graphics make learning mathematics enjoyable

Strategic Tower Defense Elements

  • Castle Defense Mechanics : Protect your fortress using mathematical prowess
  • Wave-Based Zombie Attacks : Face increasingly challenging undead hordes
  • Resource Management : Balance speed and accuracy in problem-solving
  • Multiple Difficulty Levels : Suitable for different mathematical skill levels

Free Browser Gaming

  • No Download Required : Play instantly in your web browser
  • HTML5 Technology : Smooth performance across all modern devices
  • Cross-Platform Compatible : Works on computers, tablets, and smartphones
  • Family-Friendly Content : Safe and appropriate for all ages

Game Mechanics

Mathematical Combat System

The core gameplay revolves around solving math problems to defeat zombies. Each correct answer launches an attack against the approaching undead, while incorrect solutions allow zombies to advance toward your castle. The faster and more accurately you solve problems, the more effective your defense becomes.

Strategic Planning

Success requires both mathematical skill and strategic thinking. Players must quickly assess incoming zombie threats while simultaneously solving arithmetic problems under time pressure. This dual-challenge system creates an engaging learning environment that improves both math skills and decision-making abilities.

Operation Guide

Basic Controls

  • Mouse : Click on answer options or input numerical solutions
  • Keyboard : Type mathematical answers directly
  • Enter Key : Submit your mathematical solutions
  • Space Bar : Pause game to review upcoming challenges

Gameplay Strategy

  • Start with easier difficulty levels to build confidence
  • Focus on accuracy first, then gradually increase solving speed
  • Watch zombie movement patterns to prioritize urgent threats
  • Practice mental math techniques to improve response time
  • Use the pause feature strategically during overwhelming waves

Why Play King of Math

Educational Benefits

This game transforms traditional math practice into an exciting adventure. Students can improve their arithmetic skills without feeling like they're doing homework, making it an excellent tool for both classroom use and home learning.

Entertainment Value

The tower defense format provides genuine gaming excitement while learning. The zombie theme adds adventure and urgency, keeping players engaged longer than traditional educational software.

Skill Development

  • Mathematical Fluency : Regular practice improves calculation speed
  • Problem-Solving : Strategic thinking under pressure
  • Time Management : Balancing speed with accuracy
  • Concentration : Maintaining focus during intense gameplay

Perfect for All Ages

Whether you're a student looking to improve math grades or an adult wanting to sharpen mental arithmetic skills, King of Math provides appropriate challenges for various skill levels.

Frequently Asked Questions (FAQ)