Coding “Snake” in 4 min 30 sec (plain browser JavaScript)




Support on Patreon: https://www.patreon.com/gamkedo Try my free course: http://code-your-first-game.com (or full URL is https://www.udemy.com/code-your-first-game/ ) Next steps: http://gamkedo.com The (hacky) Snake source: https://pastebin.com/Z3zhb7cY About InteractionArtist, my 219 daily prototypes: https://www.youtube.com/watch?v=BgZrBpSISS0

Original source


47 responses to “Coding “Snake” in 4 min 30 sec (plain browser JavaScript)”

  1. https://pastebin.com/sJ6kc5bi I added so it only deletes the part of the tail that you hit . . . I think lol. Any suggestions or corrections would be helpful.

    Update 1: I've been adding to it and added a redirect to another page. Let me know and I'll share it if you want. I'm trying to learn more complicated things to add for fun.

    Update 2: Added new stuff. Took away the second page and just used Javascript to change the current page. Has Play Again? button.

    Update 3: Found really cool styling and animation for the button. Added comments with sources of code.

    Update 4: If you ever read this, do you mind if I host this on my website. I wanted to ask since you wrote the base code and I'm just adding new features.

    Update 5: Put code into separated functions to make slightly easier to read. Still have to find functions. Could be objects in future. Started scoring system. Need smarter way so can keep making bigger.

    Update 6: Further put code in more organized functions. Out of bounds ends game. Maybe make game slower in future to start out? To make it easier to begin and make faster as collects apples? Add more apples and bombs on the canvas in the future?

  2. if you guys are impressed by this, you should be impressed about someone knowing a different language, that's what coding is, a different language. i'm not sure how many people are fascinating with coding more than a different language. they're both technically the same thing.

Leave a Reply