- Aubin SIONVILLE
- Estevan SCHMITT
Slice Defender is an interactive 3D game developed as part of a Computer Science course at Télécom Saint-Étienne. The player must slice flying projectiles (fruits and vegetables) using a virtual sword. The game combines real-time hand tracking (via webcam) and OpenGL rendering to create an immersive experience. The objective is to score points by slicing as many projectiles as possible while avoiding missing them.
- Start the game: Launch the application. The main window will display the game area and UI.
- Camera setup: The game uses your webcam to track your hand position. Make sure your camera is connected and working.
- Sword control: Move your hand in front of the camera to control the sword in the game. The sword follows your hand's position.
- Slice projectiles: Projectiles (apples, oranges, bananas, corn, strawberries) are launched from the cannon. Slice them with your sword before they fall.
- Scoring: Each successful slice gives you points. Missing projectiles may cost you lives.
- Game modes: You can switch between standard and original game modes for different levels of challenge.
- Restart: Use the UI buttons to restart the game or view your score.
- Hand movement: Controls the sword (requires a webcam).
- Keyboard: Some features may be accessible via keyboard (see in-game instructions).
- projectileManager.h / .cpp: Manages all projectiles in the game. Handles creation, launching, updating, drawing, and slicing of projectiles. Uses a simple random generator for projectile types and trajectories.
- projectile.h / .cpp: Abstract base class for all projectiles. Defines physics, collision, slicing, and rendering logic. Specialized projectiles (Apple, Orange, Banana, Corn, Strawberry) inherit from this class.
- projectiles/: Contains all specific projectile types and their sliced halves (e.g.,
apple.h,bananaHalf.h). Each type implements its own drawing and slicing behavior. - CameraHandler.h / .cpp: Handles webcam input and hand detection using OpenCV. Tracks the player's hand position and provides it to the game logic.
- player.h / .cpp: Represents the player's sword. Handles drawing and positioning in the 3D world.
- game.h / .cpp: Main game controller. Manages game state, scoring, lives, and player input.
- myglwidget.h / .cpp: OpenGL rendering widget. Draws the game scene, including the cannon, grid, projectiles, and sword.
- mainwindow.h / .cpp: Main application window. Integrates all components, manages UI, and handles user interactions.
- res/: Contains textures for projectiles.
- .qrc: Qt resource file for loading images.
- Open the project in Qt Creator (or your preferred Qt/C++ IDE).
- Make sure you have OpenCV and Qt installed.
- Build the project.
- Run the executable. Allow camera access if prompted.
- The game requires a webcam for hand tracking.
- All projectiles are implemented as C++ classes with clear separation between logic and rendering.
- The code is modular and documented for educational purposes.