A modern, feature-rich Snake Game built with Java Swing, featuring multiple difficulty levels, special food varieties, high score tracking, and emoji support!
Welcome screen with game instructions
Active gameplay with special food and score tracking
Game over screen showing final score and high score
Simply download and double-click to play! No installation required.
Note: Requires Java Runtime Environment (JRE) 8 or higher installed on your system.
- Download SnakeGame.jar - Run with:
java -jar SnakeGame.jar
- Operating System: Windows 7/8/10/11, Linux, or macOS
- Java: JRE 8 or higher (Download Java)
- RAM: 256 MB minimum
- Disk Space: 50 MB
- Display: 800x600 resolution or higher
- Classic Snake Gameplay - Control the snake, eat food, and grow longer
- Smooth Controls - Responsive arrow key controls
- Multiple Difficulty Levels - Easy, Medium, and Hard modes with adjustable speeds
- Wall Collision Toggle - Choose between classic mode (walls kill) or wrap-around mode
- Pause/Resume - Pause the game anytime with the Pause button
- ๐ Normal Apple (Red) - Worth 1 point
- โญ Golden Apple (Gold) - Worth 5 points, appears every 15 seconds
- ๐ Bonus Diamond (Purple) - Worth 3 points, disappears after 5 seconds!
- โก Speed Boost (Blue) - Worth 1 point + 40% speed increase for 5 seconds
- Real-time Score Display - Track your current score
- High Score Tracking - Automatically saves your best score
- Persistent Storage - High scores saved between game sessions
- New High Score Celebration - Special notification when you break records
- Clean UI - Dark theme with colorful elements
- Emoji Support - Full emoji rendering for food and messages
- Glow Effects - Special foods have glowing auras
- Score Panel - Dedicated panel below game board showing stats
- Countdown Timers - Visual timer for bonus food and speed boosts
- Download
SnakeGame.exefrom Releases - Double-click the downloaded file
- Play! ๐ฎ
- Make sure Java is installed:
java -version - Download
SnakeGame.jarfrom Releases - Run:
java -jar SnakeGame.jar
- Java Development Kit (JDK) 8 or higher
- Git (optional)
git clone https://github.com/bibekchandsah/snake-game.git
cd snake-gamejavac SnakeGame.java GamePanel.java SettingsPanel.java HighScoreManager.java Food.javajava SnakeGameSee BUILD.md for detailed instructions on creating the EXE file.
- โฌ๏ธ Up Arrow / W - Move Up
- โฌ๏ธ Down Arrow / S - Move Down
- โฌ ๏ธ Left Arrow / A - Move Left
- โก๏ธ Right Arrow / D - Move Right
Supports both Arrow Keys and WASD keys for movement!
- Click the Start button to begin
- Use arrow keys to control the snake
- Eat food to grow and earn points
- Avoid hitting yourself (self-collision = game over)
- If wall collision is enabled, avoid hitting walls
-
Difficulty Levels:
- ๐ข Easy - 150ms delay (slower, easier to control)
- ๐ก Medium - 100ms delay (moderate speed)
- ๐ด Hard - 50ms delay (fast-paced challenge)
-
Wall Collision:
- โ ON - Snake dies when hitting walls (classic mode)
- โฌ OFF - Snake wraps to opposite side (endless mode)
snake-game/
โโโ SnakeGame.java # Main application entry point
โโโ GamePanel.java # Core game logic and rendering
โโโ SettingsPanel.java # UI controls (difficulty, settings, buttons)
โโโ HighScoreManager.java # High score persistence manager
โโโ Food.java # Food types and properties
โโโ icon.ico # Application icon
โโโ highscore.dat # Saved high score (auto-generated)
โโโ preview1.png # Welcome screen screenshot
โโโ preview2.png # Gameplay screenshot
โโโ preview3.png # Game over screenshot
โโโ README.md # This file
โโโ BUILD.md # Build instructions for EXE
Download the latest version from the Releases page:
- SnakeGame.exe - Windows executable with custom icon
- SnakeGame.jar - Cross-platform JAR file
- Source code - ZIP and TAR.GZ archives
- Java - Core programming language
- Java Swing - GUI framework
- AWT Graphics - 2D graphics rendering
- Timer - Game loop mechanism
- File I/O - High score persistence
- Main window setup
- Integrates GamePanel and SettingsPanel
- Game board rendering (600x600 pixels)
- Snake movement and collision detection
- Food spawning and management
- Score tracking and display
- Difficulty selection (radio buttons)
- Wall collision toggle (checkbox)
- Start/Pause/Resume button
- Auto-updates button states
- Loads high score from file on startup
- Saves new high scores automatically
- Persistent storage using
highscore.dat
- Four food types with different properties
- Point values and visual effects
- Timed expiration for bonus food
- Speed boost functionality
- Background: Black (#000000)
- Snake Head: Bright Green (#00FF00)
- Snake Body: Dark Green (#2DB400)
- Grid: Dark Gray (#191919)
- Normal Food: Red (#FF0000)
- Golden Food: Gold (#FFD700)
- Bonus Food: Purple (#8A2BE2)
- Speed Food: Deep Sky Blue (#00BFFF)
- High Score: Yellow (#FFFF00)
- Score Panel: Dark Gray (#1E1E1E)
| Food Type | Points | Frequency | Duration | Effect |
|---|---|---|---|---|
| ๐ Normal Apple | 1 | Common | Permanent | None |
| โญ Golden Apple | 5 | Every 15s | Permanent | None |
| ๐ Bonus Diamond | 3 | Every 20s | 5 seconds | Disappears |
| โก Speed Boost | 1 | 10% chance | Permanent | +40% speed for 5s |
- Focus on Survival - Don't rush for golden apples if it's risky
- Plan Your Route - Think ahead to avoid trapping yourself
- Use Wrap Mode - Disable wall collision for easier gameplay
- Speed Boosts - Be extra careful when speed boost is active
- Bonus Food - Rush for purple diamonds before they vanish!
- High Scores - Try different difficulty levels to maximize points
- Game speed doesn't progressively increase with score
- No sound effects or background music
- Single-player only
- Fixed board size (600x600)
- Sound effects and background music
- Progressive difficulty (auto-speed increase)
- Multiple themes/skins
- Leaderboard with top 10 scores
- Obstacles and maze mode
- Two-player mode
- Achievement system
- Game statistics tracking
- Mobile/touch controls support
- โ Classic snake gameplay
- โ Three difficulty levels
- โ Wall collision toggle
- โ High score system with file persistence
- โ Four food varieties with special effects
- โ Emoji support
- โ Pause/Resume functionality
- โ Welcome screen
- โ Score panel below game board
- JDK 8+ (for lambda expressions)
- Supports emoji rendering on Windows (Segoe UI Emoji font)
All .java files should be in the same directory for compilation.
This is a learning project. Feel free to use, modify, and distribute as needed.
Feel free to fork this project and add your own features! Some ideas:
- Add sound effects
- Create new food types
- Implement power-ups
- Add multiplayer support
- Create custom themes
Have fun playing the Snake Game! Try to beat your high score and master all difficulty levels! ๐๐
Made with โค๏ธ using Java Swing
Last Updated: November 15, 2025