
let’s write a Snake game in plain JavaScript
dan
Views: 49373
Like: 1352
We’re building a Snake (in the style of the original Nokia 3210 implementation). Final code you can play with:
00:00 Setting up the stream
02:32 Which version of Snake we’re implementing
05:33 Rendering the snake
24:20 Getting the snake moving
36:07 Adding arrow keys handling
52:46 Handling multiple fast keypresses
1:07:10 Snake shouldn’t pass through walls or itself
1:20:46 Spawning food (randomly and buggy)
1:33:25 In-game restart button
1:40:19 Spawning food (non-buggy but unbounded)
1:44:46 Spawning food (bounded but with unnecessary allocations)
2:18:27 Spawning food (efficiently)
2:29:04 Implementing integrity checks
if you liked this, check out my beautiful dark twisted javascript course:
25.03.2023
Thanks @dan
well done
thanks for this beau! I use chrome as my test area and wrote this code on VScode, it didn't display nothing, please help. What IDE do you use?
Great stream, Dan, I hope you’re having fun and keep streaming!
Thanks a lot for this Dan
thank you Dan:)
great
I do hope there will be more videos like that here
the voice matches not the face
Do make videos specific on react internal concepts please. Something like in depth explanation of useState hook or something like that. Would love to learn from you💟
is this your official YouTube channel Dan?
Woah Dan on YT🤘 …
Hi Redux Guy
what editor is he using lol
You have a lot of patience to code something like that.
I hope more stream like this comes. The thinking process also teaches viewers on possibilities on how to tackle scenarios. Great stream. ❣
he is preparing for new position in Nokia
Awesome video, thanks for the content but they are really long. If you need someone to edit your stream videos and manage your YT channel, I'd be happy to do it.
utterly fascinating
Dan I like you and the stuff you do but… Please buy a Sublime license man… I'm pretty sure your Meta salary is high enough to afford it 🤣
what's up
lets not
Spiderman is on the web.
Why do you hate “const” so much?
Nice
"Final code you can play with" it means I can edit the code or copy from the code and do whatever I want with it?
How did you manage to get 12k subscribers with only 13 videos? Do you stream on other platforms?
Nice
This is much more interesting and better than those "code snake under 5 minutes in Javascript" videos where they all just memorize everything.
this was a lot of fun, thanks for making these Dan! :heart
Really appreciate that showing how to implement the game in reality!
Thank you for this. I'm self-taught. This helps me polish up my thought process.
Normally I don't click a video which is more than 15 minutes. But I am going to dedicate a peaceful weekend to practice this as the video goes. Good video. Time to think for the users as well instead of pausing.
Thank you
Thanks for uploading this kind of videos. It looks containing every consideration you have done. Very helpful.
I'm going to try to learn Javascript but I suspect that I have some sort of adhd issue.
Btw, idk if anyone ever told you, but you kind of sound like (the singer) Michael Jackson?
Have you heard of Chat.Openai? Wondering if you have or not… nvm I'm going to try to watch the video. Before I do, I'd like to ask if you believe in free will? Or do you think we are like computers in a way?