Programming a Snake Game in C# – Full Guide



Learn how to program a C# Snake game!

Download the assets here:
https://ottobotcode.com/snakeAssets

In this video you will learn how to write a Snake game in C# without using any game engine. We go over everything you need to know to program Snake step-by-step. The video even includes helpful animations to help you understand everything! The code for the game is written in C#, but the is well decoupled from the UI and can be adapted for other programming languages like Java and C++. Have fun developing a Snake game in C#!

Chapters:
0:00 – The Game
0:28 – Project Setup
1:37 – Importing Assets
3:04 – Grid Representation
4:26 – GridValue Enum
5:31 – Directions
9:53 – Positions
12:10 – The Game State
15:27 – Adding The Snake
16:49 – Adding Food
19:40 – Snake Helpers
21:10 – Snake Modification
23:20 – Moving The Snake
29:36 – Loading Images
32:10 – Color/Font Resources
34:30 – Coding UI
37:33 – Image Grid
41:28 – Adding Grid Images
44:35 – Bitmap Scaling & Removing Gaps
46:00 – Drawing The Game State
49:54 – Changing Direction (User Input)
51:33 – Moving Snake (Game Loop)
53:07 – Updating The Score
53:37 – A Strange Bug
56:13 – Changing Direction Properly
1:00:53 – Fixing Scaling
1:02:26 – Intro/End Screen
1:09:31 – Countdown
1:10:56 – Restarting The Game
1:12:56 – Googly Eyes!
1:16:08 – What The ****?
1:16:26 – Fixing Image Rotation
1:17:28 – RIP Animation
1:20:19 – Other Grid Sizes?
1:21:49 – Thanks!

Comments are closed.