Skip to content

JCHNT/SNAKE

Repository files navigation

🐍 Modern Snake Game

React TypeScript Tailwind CSS License

A modern implementation of the classic Snake game built with React and TypeScript. This project features a sleek, responsive design and modern gaming mechanics.

✨ Key Features

  • 🎮 Smooth, responsive gameplay
  • 📈 Progressive difficulty system
  • 🏆 High score tracking with localStorage
  • ⚙️ Customizable game settings
  • 🎵 Sound effects
  • 🎯 Special bonus items
  • 🔄 Multiple game states (menu, playing, paused, game over)
  • 🛡️ Borderless mode option

🛠️ Technologies Used

  • React 18.3
  • TypeScript 5.5
  • Tailwind CSS 3.4
  • Vite
  • Lucide React (for icons)

📦 Installation

  1. Clone the repository:
git clone https://github.com/yourusername/modern-snake-game.git
cd modern-snake-game
  1. Install dependencies:
npm install
  1. Start the development server:
npm run dev

🎮 How to Play

  • Use arrow keys to control the snake's direction
  • Collect red food items to grow and score points
  • Yellow bonus items appear periodically for extra points
  • Press Space to pause/resume the game
  • Press Escape to quit the current game

🔧 Configuration

The game can be customized through the settings menu:

interface GameSettings {
  speed: number;        // Initial game speed (50-200)
  gridSize: number;     // Size of the game grid
  borderless: boolean;  // Enable/disable wall collisions
  soundEnabled: boolean; // Toggle sound effects
}

🎯 Game Logic Example

// Movement control
const handleKeyPress = (e: KeyboardEvent) => {
  switch(e.key) {
    case 'ArrowUp':
      if (direction !== 'down') setDirection('up');
      break;
    case 'ArrowDown':
      if (direction !== 'up') setDirection('down');
      break;
    // ... other directions
  }
};

// Score system
const handleFoodCollection = () => {
  setScore(score + 10);
  if (score > 0 && score % 50 === 0) {
    spawnBonus();
    increaseDifficulty();
  }
};

🤝 Contributing

Contributions are welcome! Here's how you can help:

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Commit your changes: git commit -m 'Add amazing feature'
  4. Push to the branch: git push origin feature/amazing-feature
  5. Open a Pull Request

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

🔗 Additional Resources

📧 Contact

Mail - [email protected]


Made with ❤️ using React and TypeScript

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published