Skip to the content.

Creation of Snake • 4 min read

Description

How I created and edited the snake game

  • Creation of the Base Game
  • How to Add "Impossible" Mode
  • How to Change Everything's Color

Creation of the Base Game

I created the base of the game / the snake eatting apple part by following a tutorial by Mr. Mortensen. I will summarize it here. First, I created a new .md file in the _posts folder. I then went to this link SNAKE SOURCE and copied and pasted all the code on that page into the .md file. This'll create the base page, you can play snake however I edited the code and will explain how to further on.

The easiest way to create an empty .md file is to take an existing one and copy and paste it into the _posts folder. Then delete everything inside the file.

How to Add "Impossible" Mode

Adding the "Impossible" Mode speed setting is very simple, if you look through the code. Inside the code you'll see a comment over a block of code labeled "Settings Screen", under which you'll see the function for the speed settings. In order to add the "Impossible" setting you must add a new input code, just copy the code above exactly but instead of "speed#" you will add "speed4". Then you will lower the value, the lower the value the faster it will go. It will also be formatted in that same order, so if you want something to be before "Slow" place the code there and increase the number of each speed after and set the one you created to "speed1". You do not need to add a end input block as it is an empty tag. Then copy the label code but replace "speed#" with with "speed4" and name it "Impossible". Don't forget to end the label code!

How to Change Everything's Color

Changing every objects color is extremely simple,