Please help me. "It looks like you're mixing "active" and "static" modes."

Robot r1;

void setup(){
size(800, 600);
r1 = new Robot();
r1.setPos(width/2, height/2);
}

void draw(){
r1.display();
}
noStroke();
fill(204, 10);
rect(0, 0, width, height);
stroke(0);
translate(transX, transY);
scale(1.0/ratio);
transX += dirX * speedX;
if (transX > width - 400/ratio) {
dirX = -dirX;
transY += 400/ratio;
} else if (transX < 0) {
dirX = -dirX;
transY += 400/ratio;
}

class Robot {
float x = 0;
float y = 0;
float faceX = x + 200;
float faceY = y + 50;
float faceW = 100;
float faceH = 100;
color faceFill = color(255);
float l_eyeX = faceX - 20;
float l_eyeY = faceY;
float r_eyeX = faceX + 10;
float r_eyeY = faceY;
float eyeW = 10;
float eyeH = 10;
color eyesFill = color(0);
float mouthX = faceX - 30;
float mouthY = faceY + 20;
float mouthW = 50;
float mouthH = 10;
float neckX1 = faceX;
float neckY1 = faceY + 50;
float neckX2 = faceX;
float neckY2 = faceY + 70;
float chestX = faceX - 50;
float chestY = faceY + 70;
float chestW = 100;
float chestH = 150;
color chestFill = color(255);
float l_armX = faceX - 150;
float l_armY = faceY + 80;
float l_armW = 100;
float l_armH = 1;
float r_armX = faceX + 50;
float r_armY = faceY + 80;
float r_armW = 100;
float r_armH = 1;
float l_legX = faceX - 40;
float l_legY = faceY + 220;
float l_legW = 20;
float l_legH = 120;
color l_legFill = color(#19A6E5);
float r_legX = faceX + 20;
float r_legY = faceY + 220;
float r_legW = 20;
float r_legH = 120;
color r_legFill = color(#19A6E5);

float transX = x;

float transY = y;

int dirX = 1;

float speedX = 5;

float ratio = 4;

Robot() {
}

void display() {
pushMatrix();
translate(x, y);
translate(-50.0/0.25, -50.0/0.25);
update(0, 0);
head();
chest();
arms();
legs();
popMatrix();
}

void setPos(float x, float y){
this.x = x;
this.y = y;
}

void update(float x, float y) {
faceX = x + 200;
faceY = y + 50;
l_eyeX = faceX - 20;
l_eyeY = faceY;
r_eyeX = faceX + 10;
r_eyeY = faceY;
mouthX = faceX - 30;
mouthY = faceY + 20;
neckX1 = faceX;
neckY1 = faceY + 50;
neckX2 = faceX;
neckY2 = faceY + 70;
chestX = faceX - 50;
chestY = faceY + 70;
l_armX = faceX - 150;
l_armY = faceY + 80;
r_armX = faceX + 50;
r_armY = faceY + 80;
l_legX = faceX - 40;
l_legY = faceY + 220;
r_legX = faceX + 20;
r_legY = faceY + 220;
}

void head() {
//face
fill(faceFill);
ellipse(faceX, faceY, faceW, faceH);
eyes();
mouth();
neck();
}

void eyes() {
//eyes

fill(eyesFill);
ellipse(l_eyeX, l_eyeY, eyeW, eyeH);
ellipse(r_eyeX, r_eyeY, eyeW, eyeH);
}

void mouth() {
//mouth

rect(mouthX, mouthY, mouthW, mouthH);
}

void neck() {
//neck

line(neckX1, neckY1, neckX2 ,neckY2);
}

void chest() {
//chest

fill(chestFill);
rect(chestX, chestY, chestW, chestH);
}

void arms() {
//left arm

rect(l_armX, l_armY, l_armW, l_armH);

//right arm

rect(r_armX, r_armY, r_armW, r_armH);
}

void legs() {
//left leg

fill(#19A6E5);
rect(l_legX, l_legY, l_legW, l_legH);

//right leg

rect(r_legX, r_legY, r_legW, r_legH);
}
}

Hello,

Troubleshooting: looks like you’re mixing active and static modes

https://www.youtube.com/watch?v=KkHk8OLgles

:)

Yeah, somehow you’re closing the bracket} too early so you have code outside a function. Not allowed