FruitSlicer is a dynamic, arcade-style game developed in Python using Pygame, bringing the thrill of slicing flying fruits โ and avoiding deadly bombs โ to your desktop screen. Inspired by the classic Fruit Ninja, this game is designed with multiple difficulty levels, special effects, custom sprites, and sound effects, offering an immersive experience.
What sets this project apart is its development journey โ guided and accelerated by Amazon Q Developer CLI, Amazon's AI-powered assistant for developers. From initial scaffolding to implementing complex game logic, Amazon Q CLI played a crucial role in bringing this project to life.
๐ง Why Amazon Q CLI?
Amazon Q CLI is a developer-focused AI tool that helps generate, refactor, and expand code using natural language prompts. For this project, it was used to:
Scaffold the initial project structure
Generate boilerplate code for Pygame integration
Suggest and implement key mechanics (e.g., fruit slicing, difficulty scaling)
Speed up iterative development and debugging
This helped the team focus more on game design and less on repetitive coding tasks.
Project Structure
โ๏ธ Core Components Breakdown
1. game.py: The Heart of the Game
Initializes Pygame, sets up the display, and loads all assets.
Controls the game loop, game states (home, play, game over), and handles input and rendering.
Manages fruit spawning, screen transitions, and resets.
2. constants.py: Central Configuration
Defines screen size, frame rate, paths, colors, and game physics.
3. fruit.py: Fruit System
Includes regular fruits, special fruits, and bombs.
Uses a FruitFactory to generate different types.
Sliced fruits split visually and physically for realism.
4. managers.py: Gameplay Logic
ScoreManager: Updates and displays score
LivesManager: Tracks player lives
DifficultyManager: Adjusts game speed and fruit count
FruitSpawner: Controls timing and type of spawned fruits
5. input_handler.py: Interaction
Detects slicing gestures and handles UI button presses.
6. renderer.py: Visual Output
Draws fruits, UI elements, animations, and slicing trails
Displays score, lives, level, and pause/resume status
7. screens.py: Navigation Screens
Home, About, Game Over, and High Score screens are all modularized.
Stores and retrieves scores from a local JSON file
Validates whether a score is a new high score
Gameplay Features
Core Mechanics:
Slice fruits with mouse drag motions
Avoid slicing bombs or the game ends
Lose a life when a fruit drops unsliced
Get rewarded for combo slices and accuracy
Difficulty Scaling:
The game gets faster as your score increases
Fruit variety and spawn frequency increase over time
Backgrounds change dynamically with performance
Special Items:
๐ Banana โ Basic fruit
๐ Orange โ Extra points
โ๏ธ Freeze Banana โ Slows down time temporarily
๐จ Visual & Audio Polish
Custom sword cursor
Sliced fruit animations and splash effects
Background transitions
Rich soundscape: background music, slice, throw, bomb, and UI clicks
๐ฑ Game Controls
Mouse Movement: Move the sword cursor
Mouse Drag: Slice fruits
UI Clicks: Navigate through menus and pause/play the game
๐ Conclusion
FruitSlicer isnโt just a fun game โ itโs a great example of how modern tools like Amazon Q CLI can assist developers in rapidly building complex projects. From initial setup to full-featured gameplay, Q CLI helped transform raw ideas into a polished experience.
Whether you're learning game dev or experimenting with AI-powered coding tools, this project is an ideal hands-on showcase.