ok, forget translate
here is a version with working UP and SHIFT
color c20=color(255);
color c24=color(35, 155, 86);//GREEN
color c21=color(244, 208, 63);//YELLOW
color c22=color(230, 126, 34);//ORANGE
color c27=color(174);//gray
void setup()
{
//frameRate(10);
size(500, 500);
}
void draw()
{
background(200);
house();
}
// -------------------------------------------------------------------------------------------
void house() {
translate (-200, -200);
//else
//{
// color c8=color(231,76,60);//RED
//fill(c8);
//rect(mouseX+150,mouseY+200,200,180);
// }
//}
int i;
i=0;
while (i<5)
{
color c34=color(255, 51, 227);
fill(c34);
rect(mouseX+150, mouseY+140-33*i, 20, 18);
i = i+1;
}
fill(c20);
rect(mouseX+150, mouseY+200, 200, 180);
fill(c24);
triangle(mouseX+130, mouseY+200, mouseX+370, mouseY+200, mouseX+250, mouseY+100);
// color c3=color(100, 10, 0);
fill(c27);
rect(mouseX+234, mouseY+310, 30, 70);
color c4=color(60, 120, 200);
fill(c4);
rect(mouseX+160, mouseY+240, 40, 30);
color c5=color(60, 120, 200);
fill(c5);
rect(mouseX+300, mouseY+240, 40, 30);
color c6=color(60, 120, 200);
fill(c6);
ellipse(mouseX+250, mouseY+255, 70, 50);
color c7=color(249, 249, 249);
fill(c7);
rect(mouseX+247, mouseY+230, 5, 50);
fill(c7);
rect(mouseX+215, mouseY+250, 70, 5);
fill(c7);
rect(mouseX+160, mouseY+250, 40, 5);
fill(c7);
rect(mouseX+300, mouseY+250, 40, 5);
fill(c7);
rect(mouseX+317, mouseY+240, 5, 30);
fill(c21);
rect(mouseX+177, mouseY+240, 5, 30);
}
// -------------------------------------------------------------------------------------------
void keyPressed() {
if (key == CODED)
{
if (keyCode == UP)
{
c20=color(108, 52, 131); //PURPLE
}
}
// rect(mouseX+150, mouseY+200, 200, 180);
if (keyCode == DOWN)
{
c24=color(35, 155, 86);//GREEN
fill(c24);
//rect(mouseX+150, mouseY+200, 200, 180);
}
if (keyCode == LEFT)
{
c21=color(244, 208, 63);//YELLOW
fill(c21);
//rect(mouseX+150, mouseY+200, 200, 180);
}
if (keyCode == RIGHT)
{
c22=color(230, 126, 34);//ORANGE
fill(c22);
//rect(mouseX+150, mouseY+200, 200, 180);
}
if (keyCode == SHIFT)
{
println("Shift");
c27=color(174, 214, 241);//BLUE
fill(c27);
//rect(mouseX+150, mouseY+200, 200, 180);
}
}
//