A thrilling 3D catapult game built with Three.js and Vite. Choose your level, charge up your catapult's power, and launch projectiles to defeat enemies across challenging stages! 🚀
- 🎮 Level Selection: Choose from 4 unique levels (1 to 4) before starting a new game, each with increasing difficulty.
- 🎯 Power-Based Gameplay: Hold a button or key to charge the catapult’s power and release to fire.
- 🖼️ 3D Graphics: Smooth and immersive visuals powered by Three.js.
- ⚡ Physics-Based Mechanics: Realistic projectile motion with Cannon.js.
- 🏆 Stage Progression: Defeat all enemies in a level to complete it and replay or choose another level.
- 🖱️ Simple Controls: Use mouse or keyboard to select levels, charge, and fire.
- 🚀 Fast Development: Built with Vite for a modern, blazing-fast dev experience.
- 📱 Responsive Design: Playable on desktop and mobile devices.
- 🌍 Open Source: Fork, modify, and contribute!
- Three.js: JavaScript 3D library for rendering.
- Cannon.js: Physics engine for realistic projectile motion.
- Vite: Next-generation frontend tooling for fast builds and development.
- HTML5/CSS3: Game interface and styling.
- JavaScript: Core game logic and interactivity.
- Node.js (v16 or higher)
- A modern web browser (Chrome, Firefox, Edge, etc.)
- Clone the repository:
git clone https://github.com/Sina-Ghiasi/threejs-catapult-game.git
- Navigate to the project directory:
cd threejs-catapult-game
- Install dependencies:
npm install
- Start the development server:
npm run dev
- Open your browser and visit
http://localhost:5173
(or the port shown in the terminal) to play.
To create a production-ready build:
npm run build
The output will be in the dist
folder. Serve it with any static file server.
- Select Level: Choose a level (1 to 4) from the main menu before starting a new game. Higher levels increase difficulty.
- Charge Power: Hold the mouse button or a designated key (e.g., spacebar) to increase the catapult’s firing power.
- Fire: Release the button/key to launch the projectile at a fixed angle.
- Defeat Enemies: Hit all enemies in the selected level to win and return to the level selection menu.
- Replay or Switch Levels: After completing a level, choose to replay or select a different level.
Main Menu | Gameplay |
---|---|
![]() |
![]() |
Contributions are welcome! 🙌 Follow these steps:
- Fork the repository.
- Create a new branch (
git checkout -b feature/awesome-feature
). - Make your changes and commit (
git commit -m 'Add awesome feature'
). - Push to the branch (
git push origin feature/awesome-feature
). - Open a Pull Request.
This project is licensed under the MIT License. See the LICENSE file for details. The MIT License applies retroactively to all code and commits in this repository, including past contributions, unless explicitly stated otherwise.
Play the game now at https://sina-ghiasi.github.io/threejs-catapult-game/