Skip to content

ronishpaudel/dotnet_snakegame

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Snake Game Web App

Overview

This is a classic Snake game implemented as a web application using ASP.NET Core Razor Pages with JavaScript. The game features a responsive design, dynamic difficulty, and intuitive controls.

Features

  • 🐍 Classic Snake gameplay
  • 🎮 Start, Pause, and Restart functionality
  • 📈 Dynamic difficulty (speed increases with score)
  • 🎨 Responsive and modern UI
  • 🖥️ Cross-platform web compatibility

Technologies Used

  • Backend: ASP.NET Core 8.0 Razor Pages
  • Frontend: HTML5 Canvas
  • Languages: C#, JavaScript
  • Styling: CSS

Prerequisites

Installation

  1. Clone the repository:
git clone https://github.com/yourusername/snake-game.git
cd snake-game
  1. Restore dependencies:
dotnet restore
  1. Run the application:
dotnet run
  1. Open your browser and navigate to https://localhost:5001

Game Controls

  • Arrow Keys: Change snake direction
  • Start Button: Begin the game
  • Pause Button: Pause/Resume gameplay
  • Restart Button: Start a new game after game over

Gameplay Mechanics

  • Snake moves continuously in the last selected direction
  • Eat food to grow longer and increase score
  • Avoid hitting walls or the snake's own body
  • Game speed increases every 5 points

Project Structure

snake-game/
│
├── Controllers/
├── Pages/
│   └── Index.cshtml
│   └── Index.cshtml.cs
│
├── wwwroot/
│   ├── css/
│   │   └── snake.css
│   └── js/
│       └── snake.js
│
└── README.md

Customization

You can easily modify:

  • Canvas size in wwwroot/js/snake.js
  • Game speed progression
  • Styling in wwwroot/css/snake.css

Contributing

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

License

Distributed under the MIT License. See LICENSE for more information.

Contact

Email: [email protected]

Project Link: https://github.com/ronishpaudel/snake-game

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published