So I've been watching the coding train to learn to code in javascript and I tried to copy his code but it doesn't work. I'm using brackets. Here is the episode:
https://www.youtube.com/watch?v=fBqaA7zRO58&t=0s&list=PLRqwX-V7Uu6Zy51Q-x9tMWIv9cueOFTFA&index=26
let bubbles = []
function setup() {
createCanvas(600,400)
for (let i = 0; i < 3; i++) {
let x = 10 + 30 * i
bubbles[i] = new Bubble(x, 200, 40);
}
}
function draw() {
background(0);
for(let i = 0; i < bubbles.lenght; i++) {
bubbles[i].move;
bubbles[i].show;
}
}
class Bubble {
constructor(x,y,r) {
this.x=x;
this.y=y;
this.r=r;
}
move() {
this.x = this.x + random(-5,5);
this.y = this.y + random(-5,5);
}
show() {
stroke(255);
strokeWeight(4);
noFill();
ellipse(this.x, this.y, this.r * 2);
}
}