A fully functional Snake game built with C# and Windows Presentation Foundation (WPF). The game features smooth movement, grid-based gameplay, and real-time player input handling through arrow keys.
- ๐ฎ Classic Snake gameplay
- ๐ฏ Collect food and grow the snake
- ๐ฅ Collision detection with walls or self
- โจ๏ธ Arrow key controls
- ๐งฑ Grid-based rendering with XAML canvas
- ๐งฉ Clean modular architecture with enums and logic separation
- Language: C#
- Framework: .NET WPF
- UI: XAML
- IDE: Visual Studio 2022
git clone https://github.com/SphiweNdou/wpf-snake-game.git
cd wpf-snake-game- Open the
SSSnake.slnfile. - Set the
SSSnakeproject as the startup project. - Press
F5to run the application.
This application does not require a database. All game state is managed in memory during runtime for performance and simplicity.
- Built using WPF and XAML
- Grid rendered inside a dynamic canvas in
MainWindow.xaml - Visual updates triggered through game logic in
MainWindow.xaml.cs - Snake segments and food are drawn in real time as the snake moves
- โ / โ / โ / โ โ Move the snake
- Game ends if the snake hits the wall or itself
Snake.csโ Main logic for snake movement and growthDirection.csโ Enum for movement directionGridCell.csโ Class representing a cell in the playfieldMainWindow.xamlโ UI layout with canvas and visual componentsMainWindow.xaml.csโ Event handling and game loop
Sphiwe Ndou
Desktop App Developer | .NET Enthusiast
GitHub: @SphiweNdou
LinkedIn: linkedin.com/in/yourprofile