nature-of-code / noc-examples-p5.js-archived

Port to p5.js of Nature of Code examples
MIT License
1.05k stars 552 forks source link

why isn't this code working and how can i make it work... please help #83

Closed dhawal-sharma closed 2 years ago

dhawal-sharma commented 5 years ago

var w;

function setup() { createCanvas(500,500); w = new Walker(); }

function draw() { background(51); w.walk(); w.display(); }

function Walker() { this.x1 = 50; this.y1 = 50; this.x2 = 50; this.y2 = 50; this.x3 = 50; this.y3 = 50;

this.walk = function() { this.x1 = this.x1 + random(50,250); this.y1 = this.y1 + random(50,250); this.x2 = this.x2 + random(50,250); this.y2 = this.y2 + random(50,250); this.x3 = this.x3 + random(50,250); this.y3 = this.y3 + random(50,250);

}

this.display = function() { fill(50,150,100); triangle(this.x1,this.y1,this.x2,this.y2,this.x3,this.y3); } }

gouravbro commented 4 years ago

Make function Wlaker in small letter Ex. function walker(){ }

shiffman commented 2 years ago

Apologies I was never able to answer this! Unfortunately for code help a better place to ask is the Processing forum or Coding Train discord! Did you ever solve this?

https://discourse.processing.org/ https://thecodingtrain.com/discord