In coding challenge, I attempt to code a p5.js version of the Snake Game.
๐http://thecodingtrain.com/CodingChallenges/003-snake-game-p5.html
๐ฅ Debugging: : https://youtu.be/yUO2bWfBgN8?t=2340
๐ฅ 2018 version! https://youtu.be/OMoVcohRgZA
๐ปhttps://editor.p5js.org/codingtrain/sketches/HkDVpSvDm
๐https://en.wikipedia.org/wiki/Snake_(video_game)
๐ Website: http://thecodingtrain.com/
๐ Patreon: https://patreon.com/codingtrain
๐ Store: https://www.designbyhumans.com/shop/codingtrain/
๐ Books: https://www.amazon.com/shop/thecodingtrain
๐ฅ Coding Challenges: https://www.youtube.com/playlist?list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH
๐ p5.js: https://p5js.org
๐ Processing: https://processing.org
๐ Code of Conduct: https://github.com/CodingTrain/Code-of-Conduct
Original source
22 responses to “Coding Challenge #3: The Snake Game”
If you want to know what happened during "technical difficulties"! https://youtu.be/yUO2bWfBgN8?t=1253
"we need something to call the size of this grid, I dunno what to call it.. what, R.
R? R.. let's call it R.
What we want to do is call it SCL"
I've been learning c# and this looks very similar. What is the difference?
How do I make the snake not go into itself? I have it set up like this: https://gyazo.com/7445ec3e5776b23f1442a4553087e184 but when the user presses both the up and the right arrow, it kills the snake because it goes to the opposite direction.
var s;
function setup() {
createCanvas(400, 400);
s = new Snake()
}
function draw() {
background(51);
s.update()
s.show()
}
function Snake() {
this.x = 0;
this.y = 0;
this.xspeed = 1;
this.yspeed = 0;
this.update = function() {
this.x = this.x + this.xspeed;
this.y = this.y + this.ypseed;
}
this.show = function() {
rect(this.x, this.y, 10, 10)
fill(255)
}
}
can u find any mistake?
Love your videos, did a Phaser version here: http://bit.ly/javascript-game-snake
You should release your this dot music to the worldwide
very cool
How do you get your rectangle if you are not even calling this shit? How do you get chrome execute it instead of just view the file? All I see is some code but I have no idea how all this is even working.
And cut this positive crap, I wanted to see the JS expert and not a fucking clown, laughing at your own geeky jokes is something you dont want to do if you want to have any charisma at all.
Anyone else just come here for the satisfying typing lmao.
This is cool but I wish it wasnโt 25 dollars
Wow! I like it! This guy is so brilliant! :3 :)))
me: (getting into coding)
also me: (copying javascript) mhm yea that makes sense
Man you are my hero!! You have coded so many things so far!!! Thank you!!!!
Great vid ๐
Next time you should code god of war 5 ๐
JavaScript is starting to look easier than c++…
this = open("The_Coding_Train.txt", "r")
print(this.read())
Hello Snake
I've taken my time to learn python and I really enjoy it but java looks great as well should I learn java next?
Coding Challenge #3: The Kevin Durant Game
is it possible to do this in processing?
1,5x speed works