Coding Challenge #3: The Snake Game




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”

  1. 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?

  2. 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.

Leave a Reply