I will start by creating a comprehensive structure for a 2D action-platformer "Hollow Knight" style game. This includes a robust physics engine, combat system, multiple rooms (levels), enemy AI, and a New Game Plus (NG+) system.
First, I'll install some necessary icons and utility libraries.
I'll start by setting up the core game engine components, including types, constants, and the main game loop. I'll create a src/game directory to organize the logic.
First, I'll update index.html with a proper title.
I'll read the index.html to find the correct title tag.
Now I will update the title in index.html.
I will now create the game's core types and constants in src/game/types.ts. This will define the player, enemies, world, and state.
Now I will create the initial game state and world configuration in src/game/world.ts. This will include multiple rooms and the first boss.
Now I will create the engine logic in src/game/engine.ts. This file will handle physics, collisions, enemy AI, and state updates. It's the most critical part of the application.
I'll ignore the lint errors for now as they are mostly unused variables or imports that might be needed later, and I'll focus on the UI and game loop.
Now, let's create the React components. I'll start with a GameCanvas component that will render the game state. I'll also add some CSS for the pixel-art look.
Now I will create the main UI and game state management in src/App.tsx. This will include the HUD, the New Game Plus logic, and the game loop using requestAnimationFrame.
I'll fix the lint errors in src/App.tsx and src/game/engine.ts. Specifically, initializing useRef correctly and removing unused variables. Then I'll add the ability to unlock the dash in the first room to demonstrate the upgrade mechanic.
First, let's fix the minor issues in src/App.tsx and src/game/engine.ts.
I'll now add a small "Upgrade" item to the game world. I'll modify src/game/types.ts to include pickups and then update the engine and world.
I'll update src/game/world.ts to include the pickups array in each room and add a dash upgrade in the first room. I'll also add a double jump upgrade in the hallway.
Now I'll update the engine to handle pickup collisions and the drawing logic to render them. I'll also fix the lint errors by removing unused variables.
First, update src/game/engine.ts to include pickup logic and remove unused variables.
I'll fix the remaining engine errors and update updateProjectiles and updateEnemy to match the new signatures and remove unused variables. I'll also update the GameCanvas to render pickups.
I'll fix the last few lint errors in src/App.tsx and update GameCanvas.tsx to draw the pickups. Then I'll be ready to build.
First, removing unused variables in src/App.tsx.
Now I will update src/game/GameCanvas.tsx to render the pickups. I'll use a glowing effect for the items.
I'll do one final check on the updateGame logic to ensure the player's soul increases when hitting enemies, which is a key mechanic of Hollow Knight. Then I'll build the project.
I'll update src/game/engine.ts to add soul gain.
I'll also add a "Heal" mechanic in src/game/engine.ts. If the player has enough soul and holds the "Focus" key (let's say 'H' or 'R'), they can heal. For simplicity in this action game, I'll make it so if they have 33 soul they can heal 1 HP.
Everything seems ready. I have:
- Core physics and collision engine.
- Enemy AI (Crawlers, Flyers, Bosses).
- Upgrades (Dash, Double Jump) and Pickups.
- Room Transitioning.
- New Game Plus (NG+) system that scales difficulty/power.
- Hollow Knight mechanics like Soul, Healing (Focus), and Nail Combat.
- HUD with Hearts, Soul bar, and NG+ status.
I'll now build the project.
I have completed the "Void Knight" game.
Key Features:
- Combat & Soul Mechanic: Attack enemies to gain Soul, which you can use to Heal (press 'H' or 'R').
- Upgrades: Find the "Dash" and "Double Jump" items hidden in the rooms to reach the Boss.
- Enemies: Encounter different types of enemies with specific AI patterns.
- Boss Fight: A challenging final encounter in the Boss Lair.
- New Game Plus (NG+): After defeating the boss, you can start again with your upgrades and extra HP, but the world remains a cycle of ever-increasing challenge.
- Rooms: Seamless transitions between the Start Area, Hallway, and Boss Lair.
Controls:
- WASD / Arrows: Move & Jump
- J / F: Attack
- Shift / K: Dash (after unlocking)
- H / R: Heal (requires 33% Soul)
Enjoy the journey through the void!
Files built: index.html, src/game/types.ts, src/game/world.ts, src/game/engine.ts, src/game/GameCanvas.tsx, src/App.tsx