120_CreativeCoding: not showing up
Hi I’m trying to do a combination of the two example from the website, to create some buzzing bees. My problem is that nothing is showing up. Here’s my code. `// setting varables let bee = []; let num_of_bees = 35; let bg_color;
//setup function setup(){ createCanvas(windowWidth, 300); bg_color = color(45, 255, 163);
for (let i = 0; i < num_of_bees; i++) { bee.push( new BuzzBee() ); }
}
function draw(){ background(bg_color);
for (var i = 0; i < bee.length; i++) { bee[i].frame();
} }
//creating the class class BuzzBee { constructor() { this.x = x; this.y = y; this.size_h(20, 50); this.size_w(20, 50); this.loc_x = random(width); this.loc_y = random(height); this.body_color = color(235, 180, 5); this.eye_x = this.size_h * 0.23 * -1; this.eye_y = this.size_w * 0.15; this.eye_size = this.size_w * 0.25; this.ant_x = this.eye_x * 1.5; this.ant_y = this.eye_y * 2.5; this.ant_size this.eye_size * 0.5; this.feet_x = this.size_w * 0.25; this.feet_y = this.size_h * 0.5; this.feet_w = this.size_w * 0.5; this.feet_h = this.size_h * 0.4; this.left_foot_angle = 0; this.right_foot_angle = 0; }
display(){
push();
//body translate(this.loc_x, this.loc_y); fill(this.body_color);
ellipse(0, 0, this.size_w, this.size_h);
//eye fill(255); ellipse(-this.eye_x, this.eye_y, this.eye_size, this.eye_size); ellipse(this.eye_x, this.eye_y, this.eye_size, this.eye_size);
//anntena fill(5); ellipse(-this.ant_x, this.ant_y, this.ant_size, this.ant_size); ellipse(this.ant_x, this.ant_y, this.ant_size, this.ant_size);
//feet push(); rotate(PI * (this.right_foot_angle * 0.01)); translate(this.feet_x, this.feet_y); scale(1,-1); arc(0, 0, this.feet_w, this.feet_h, 0, PI, CHORD); pop();
push(); rotate(PI * -(this.left_foot_angle * 0.01)); translate(-this.feet_x, this.feet_y); scale(1,-1); arc(0, 0, this.feet_w, this.feet_h, 0, -PI, CHORD); pop();
pop();
move(){ this.x = this.x + random(-5,5); this.y = this.y + random(-5,5);
}
}
}`
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 30
Don you are just the coolest.