I need help with my code(scale problem)

please format code with </> button * homework policy * asking questions

So I was working on my code, which is to draw three bees, and each time they bounce on to wall or hive, they would bounce back(aka change their direction), while I have done that without any problem, I was trying to apply scale function, where they would increase the size depend on number generated randomly from 2-4. And I used scale() function, but the problem is that it also changed the beginning location of bee, and for some reason, they don’t bounce back. I have been working on it for good few hours, and still can’t figure out why can anyone help me with this problem?

Here is the code I used:
void setup() {
size(800, 800);
beeX1 = width/2; beeY1=height/2;
beeX2 = width/2; beeY2=height/2;
beeX3 = width/2; beeY3=height/2;
combX = width2/3; combY = height2/3;
}
float beeX1, beeY1;
float beeX2, beeY2;
float beeX3, beeY3;
int beeDX1=1, beeDY1=1;
int beeDX2=-1, beeDY2=1;
int beeDX3=1, beeDY3=-1;
int count=0;
float combX, combY;
boolean bCrash1=false, bCrash2=false, bCrash3=false;
int r1=int(random(2,5));
int r2=1;//int(random(2,4));
int r3=1;//int(random(2,4));
void draw() {
background(200, 250, 50);

drawHoneycomb(combX, combY, count);

beeX1+=2beeDX1;
if(beeX1+20>width || beeX1-20<0) {beeDX1 = -beeDX1; bCrash1=false;}
beeY1+=3
beeDY1;
if(beeY1+20>height || beeY1-20<0) {beeDY1 = -beeDY1; bCrash1=false;}
drawBee(beeX1, beeY1,r1);

beeX2+=2beeDX2;
if(beeX2+20>width || beeX2-20<0) beeDX2 = -beeDX2;
beeY2+=1
beeDY2;
if(beeY2+20>height || beeY2-20<0) beeDY2 = -beeDY2;
drawBee(beeX2, beeY2,r2);

beeX3+=3beeDX3;
if(beeX3+20>width || beeX3-20<0) beeDX3 = -beeDX3;
beeY3+=2
beeDY3;
if(beeY3+20>height || beeY3-20<0) beeDY3 = -beeDY3;
drawBee(beeX3, beeY3,r3);

if(beeY1+20 > combY-40 && beeY1-20 < combY+40 && beeX1+20 > combX-40 && beeX1-20 < combX+40 ) {
beeDX1 = -beeDX1;
beeDY1 = -beeDY1;
count++;
}
if(beeY2+20 > combY-40 && beeY2-20 < combY+40 && beeX2+20 > combX-40 && beeX2-20 < combX+40 ) {
beeDX2 = -beeDX2;
beeDY2 = -beeDY2;
count++;
}
if(beeY3+20 > combY-40 && beeY3-20 < combY+40 && beeX3+20 > combX-40 && beeX3-20 < combX+40 ) {
beeDX3 = -beeDX3;
beeDY3 = -beeDY3;
count++;
}

}

void drawBee(float bx, float by, int scale) {
pushMatrix();
scale(scale);
fill(255, 255, 0);
ellipse(bx, by-15, 12, 6);
fill(0);
ellipse(bx, by-10, 8, 4);
fill(255, 255, 0);
ellipse(bx, by+3, 16, 22);
triangle(bx-2, by+14, bx+2, by+14, bx, by+20);
fill(0);
ellipse(bx-4, by-16, 4, 4);
ellipse(bx+4, by-16, 4, 4);
arc(bx-6, by-18, 8, 4, radians(270), radians(360));
arc(bx+6, by-18, 8, 4, radians(180), radians(270));
fill(0);
rect(bx-6, by-4, 12, 2);
rect(bx-8, by+2, 16, 2);
rect(bx-6, by+8, 12, 2);
fill(150,200, 255);
ellipse(bx-12, by-4, 16, 8);
ellipse(bx-12, by+3, 16, 10);
ellipse(bx+12, by-4, 16, 8);
ellipse(bx+12, by+3, 16, 10);
popMatrix();
}

void drawHoneycomb(float hx, float hy, int count) {
int maxX=3, maxY=6;
for(float j=0; j<maxY; j++) {
for(float i=0; i<maxX; i++) {
// 역삼각형
fill(255, 255, 255-count50);
triangle(hx-maxX/2
20+i20-(j+1)%210, hy-maxY/220+j20, hx-maxX/220+i20+10-(j+1)%210, hy-maxY/220+j20+20, hx-maxX/220+i20+20-(j+1)%210, hy-maxY/220+j20);
}
if(j < maxY/2) maxX++;
else maxX–;
for(float i=0; i<maxX; i++) {
// 정삼각형
fill(255, 255, 255-count5);
triangle(hx-maxX/2
20+i20-j%210, hy-maxY/220+j20+20, hx-maxX/220+i20+10-j%210, hy-maxY/220+j20, hx-maxX/220+i20+20-j%210, hy-maxY/220+j20+20);
}
}

}Preformatted text

Hi @Fungineer1 Welcome to the forum.
Please edit your post above by clicking on the pencil.
Then select all your code and click on the </> button in the editing box.
To scale the bee you’ll first have to make a shape of the whole bee, and then apply the scale() function on that shape in draw().