How to Code a 2D Snake Game (in less than 20 minutes! ) ๐Ÿ•น A Unity Tutorial for Beginners - playproduction.de

How to Code a 2D Snake Game (in less than 20 minutes! ) ๐Ÿ•น A Unity Tutorial for Beginners

MKGames Art & Visuals
Views: 7788
Like: 103
In this video, I’ll explain to you how to create a simple 2D snake game from scratch without using any external assets. We need to write some C# code for this which I explain to you in detail.
If you want to learn some basic Unity concepts, following this tutorial will be very useful.
โžก๏ธ Iโ€™ll guide you step by step through the code and explain the core concepts. It is always good to practice your programming fundamentals with projects like this.

๐Ÿ’ฏ Watch the video to see the full tutorial and check out the project files on the GitHub link below!
GitHub project:
3D Snake for iOS:

๐Ÿ’ฌ Hope you’ll learn some new stuff in this Unity tutorial and let me know your opinion! Were you able to code up the 2D snake game and get it working? Let me know in the comments below.

โœ… Subscribe to MKGames Art & Visuals here:

——————————————–
โœจ Welcome to the official channel of MKGames Art & Visuals! โœจ

Iโ€™m a psychedelic app developer and programmer from Germany who makes visually attractive and trippy-looking apps. This channel has a variety of content that is valuable for programmers, producers, artists, or anyone who wants to make creative digital visuals.
โžก๏ธ My name is Marvin and I’ve been learning about Unity for over 6 years, so I’ve decided to share some of my knowledge and create tutorials about developing games in Unity. It can be hard to learn how to use all the tools if you are an artistโ€ฆ that’s why I guide you through how to use different apps to create awesome, trippy, and creative visuals.

My current app portfolio contains 11 apps and two of my most important apps are Fluids & Sounds Simulation LWP and Vythm JR – Music Visualizer VJ. Both of them have been installed more than 50 thousand times!
โžก๏ธ Other notable apps of mine are Magic Fractals 2D Fractals and Shapes 3D!
So, if you are into visually attractive game and app development, you should subscribe to the channel to stay updated on all of my content, and hit the bell to never miss an upload!๐Ÿ””

—————
๐Ÿ“ฒ Follow MKGames Art & Visuals on Social Media:

TikTok โ–ถ๏ธ
Instagram โ–ถ๏ธ
Facebook โ–ถ๏ธ

๐Ÿ“ง Do you have any problems with one of my apps or ideas for a new feature? Feedback is always appreciated, please use: [email protected]

โ˜‘๏ธ I created several apps which you can find in the Playstore () and in the AppStore ().
โ˜‘๏ธ Fluids & Sounds is also available on Steam:

—————
#CodeSnakeInUnity #CodeSnake #MKGames #ArtAndVisuals #unity #dev #indiedev #unity2d
#UnityTutorial

15 Comments

  1. For some reason I canโ€™t drag the points to the snake script in the main camera inspector. Therefore my points are not adding up when the snake eats the food. Plzzz help ๐Ÿ™๐Ÿ™

  2. the snake moves really slow, i set the time but it still move very slowly.

  3. There is a glitch in the code that makes the snake go in opposite direction and hit its tail which should not be happening. You just need to a boolean to prevent it from doing so.
    if (Input.GetKey(KeyCode.DownArrow) && down == true)

    {

    dir = Vector2.down;

    down = true; top = false; right = true; left = true;

    }

    else if (Input.GetKey(KeyCode.UpArrow) && top == true)

    {

    dir = Vector2.up;

    down = false; top = true; right = true; left = true;

    }

    else if (Input.GetKey(KeyCode.RightArrow) && right == true)

    {

    dir = Vector2.right;

    down = true; top = true; right = true; left = false;

    }

    else if (Input.GetKey(KeyCode.LeftArrow) && left == true)

    {

    dir = Vector2.left;

    down = true; top = true; right = false; left = true;

    }

  4. My snake is not as fast as your how to change its speed?

  5. can you change that blocks of snake to actual snake sprite/skin?

  6. plz send me code your video is not clear

  7. 4:55 im having a problem where it wont let me change the properities of the script. How do i fix this

  8. Thank you! As a web developer I can write a snake games using javascript with the canvas using few more than a dozen lines, but now trying to learn Unity I was struggling to understand some basic concepts because it's a different way to thinking. You had help me a lot!

  9. This is not that bad, but you have done this code so hard. If you do tutorials, check other solutions)

  10. hey I cant add the script component to the main camera. How do I fix?

  11. how do I change the colour of the blocks and also change the background of the game instead of having a blue backround

Leave a Reply

Your email address will not be published.