Doing the zoog assignment and we are starting with the class chapters. We are working on our zoog and I can’t figure out what is wrong with my code.
I am a suppperrr beginner. My brain just isn’t processing (ha see what I did there?) this and I need help.
void setup() {
size(500, 300);
meich = new Meich(width/2, height/2, 60, 60, 16);
int eyeSize, eyeSize2;
Meich meich;
}
void draw() {
background(247, 223, 242);
float factor = constrain(mouseX/10, 0, 5);
meich.jiggle(factor);
meich.display();
}
class Meich {
// Zoog's variables
float meichX, meichY, meichW, meichH, eyeSize;
}
// Zoog constructor
Meich(float tempX, float tempY, float tempW, float tempH, float tempEyeSize) {
meichX = tempX;
meichY = tempY;
meichW = tempW;
meichH = tempH;
eyeSize = tempEyeSize;
}
// Move Zoog
void jiggle(float speed) {
// Change the location of Zoog randomly
meichX = meichX + random(-1, 1)*speed;
meichY = meichY + random(-1, 1)*speed;
// Constrain Zoog to window
meichX = constrain(meichX, 0, width);
meichY = constrain(meichY, 0, height);
}
// Display Zoog
void display() {
// Set ellipses and rects to CENTER mode
ellipseMode(CENTER);
rectMode(CENTER);
// Loop Arms
for (float i = meichY + 5; i < meichY + meichH; i += 10) {
stroke(0);
line(meichX-meichW/3, i, meichX+meichW/3, i);
// Draw body
stroke(0);
fill(2, 242, 218);
rect(meichX, meichY, meichW/5, meichH*2);
//head
stroke(0);
fill(242, 225, 208);
ellipse(meichX, meichY-30, meichW, meichH);
//eyes
eyeR = random(255);
eyeG = random(255);
eyeB = random(255);
fill(eyeR, eyeG, eyeB);
ellipse(meichX-meichW/3, meichY-meichH/2, eyeSize, eyeSize*2);
ellipse(meichX+meichW/3, meichY-meichH/2, eyeSize, eyeSize*2);
//nose
fill (242, 194, 177);
ellipse (meichX, meichY-25, 5, 3);
// mouth
fill (242, 2, 2);
ellipse (meichX, meichY-12, 20, 10);
//legs
stroke(150);
line(meichX-meichW/12, meichY+meichH, meichX-meichW/4, meichY+meichH+10);
line(meichX+meichW/12, meichY+meichH, meichX+meichW/4, meichY+meichH+10);
}