- Introduction
- Features
- Demo
- Installation
- How to Play
- Game Modes
- Controls
- Technical Details
- Code Structure
- Customization
This is an interactive web-based game where players navigate multiple balls through a complex maze using a virtual joystick. The game combines elements of skill, strategy, and physics to create an engaging and challenging experience.
- Interactive maze with multiple balls
- Physics-based ball movement
- Virtual joystick control
- Collision detection with walls
- Two game modes: Easy and Hard
- Responsive design
- Customizable appearance
To run the Maze Game locally, follow these steps:
-
Clone the repository:
git clone https://github.com/your-username/maze-game.git
-
Navigate to the project directory:
cd maze-game
-
Open the
index.html
file in a modern web browser.
No additional dependencies or build steps are required.
- Click on the joystick to start the game.
- Use the mouse to tilt the maze by moving the joystick.
- Guide all the balls to the center of the maze.
- Avoid black holes in hard mode.
- Complete the game as quickly as possible!
- Easy Mode: Navigate all balls to the center without any obstacles.
- Hard Mode: Navigate all balls to the center while avoiding black holes.
- Mouse: Click and drag the joystick to tilt the maze.
- Space: Reset the game.
- H: Switch to Hard mode.
- E: Switch to Easy mode.
The Maze Game is built using the following technologies:
- HTML5
- CSS3
- JavaScript (ES6+)
Key technical features include:
- Canvas-free rendering using DOM elements
- Physics simulation for ball movement
- Efficient collision detection algorithms
- Responsive design for various screen sizes
The project consists of three main files:
index.html
: Contains the game's HTML structure.styles.css
: Defines the game's appearance and layout.script.js
: Implements the game logic and physics.
Key components in the JavaScript code:
resetGame()
: Initializes and resets the game state.main()
: The main game loop, handling physics and collision detection.rollAroundCap()
: Simulates ball collision with wall corners.- Event listeners for user input and game control.
You can easily customize the game's appearance by modifying the CSS variables in the styles.css
file:
body {
--background-color: #ede6e3;
--wall-color: #36382e;
--joystick-color: #210124;
--joystick-head-color: #f06449;
--ball-color: #f06449;
--end-color: #7d82b8;
--text-color: #210124;
}
To modify the maze layout, edit the walls
array in the script.js
file.