1.按鈕操作
void setup(){
size(600,650);
}
//boolean a=false;
//boolean s=false;
void draw()
{
int sice=0;
//if(a=true)
// {
// fill(0);
// rect(50, 100, 100, 100);
//}
if (keyPressed)
{
//////////////////////////////////////////////////第一排
if (key == 'a' || key == 'A')
{
fill(0);
rect(50, 100, 100, 100);
// a=true;
}
else if(key == 's' || key == 'S')
{
fill(0);
rect(180, 100, 100, 100);
// s=true;
}
else if(key == 'd' || key == 'D')
{
fill(0);
rect(310, 100, 100, 100);
}
else if(key == 'f' || key == 'F')
{
fill(0);
rect(440, 100, 100, 100);
}
/////////////////////////////////////////////////第二排
if (key == 'z' || key == 'Z')
{
fill(0);
rect(50, 230, 100, 100);
}
else if(key == 'x' || key == 'X')
{
fill(0);
rect(180, 230, 100, 100);
}
else if(key == 'c' || key == 'C')
{
fill(0);
rect(310, 230, 100, 100);
}
else if(key == 'v' || key == 'V')
{
fill(0);
rect(440, 230, 100, 100);
}
/////////////////////////////////////////////第三排
if (key == 'y' || key == 'Y')
{
fill(0);
rect(50, 360, 100, 100);
}
else if(key == 'u' || key == 'U')
{
fill(0);
rect(180, 360, 100, 100);
}
else if(key == 'i' || key == 'I')
{
fill(0);
rect(310, 360, 100, 100);
}
else if(key == 'o' || key == 'O')
{
fill(0);
rect(440, 360, 100, 100);
}
////////////////////////////////////////////第四排
if (key == 'h' || key == 'H')
{
fill(0);
rect(50, 490, 100, 100);
}
else if(key == 'j' || key == 'J')
{
fill(0);
rect(180, 490, 100, 100);
}
else if(key == 'k' || key == 'K')
{
fill(0);
rect(310, 490, 100, 100);
}
else if(key == 'l' || key == 'L')
{
fill(0);
rect(440, 490, 100, 100);
}
}
else
{
fill(255);
/////////////////////////////////////////////第一排
rect(50, 100, 100, 100);
rect(180, 100, 100, 100);
rect(310, 100, 100, 100);
rect(440, 100, 100, 100);
///////////////////////////////////////////////第二排
rect(50, 230, 100, 100);
rect(180, 230, 100, 100);
rect(310, 230, 100, 100);
rect(440, 230, 100, 100);
//////////////////////////////////////////////第三排
rect(50, 360, 100, 100);
rect(180, 360, 100, 100);
rect(310, 360, 100, 100);
rect(440, 360, 100, 100);
//////////////////////////////////////////////第四排
rect(50, 490, 100, 100);
rect(180, 490, 100, 100);
rect(310, 490, 100, 100);
rect(440, 490, 100, 100);
}
2.分數的圖片
if(sice==0)
{
fill(0);
rect(340,180,60,20);
rect(400, 200, 20, 60);
rect(400, 280, 20, 60);
rect(340,340,60,20);
rect(320, 280, 20, 60);
rect(320, 200, 20, 60);
}
if(sice==1)
{
fill(0);
rect(400, 200, 20, 60);
rect(400, 280, 20, 60);
}
if(sice==2)
{
fill(0);
rect(340,180,60,20);
rect(400, 200, 20, 60);
rect(340,260,60,20);
rect(320, 280, 20, 60);
rect(340,340,60,20);
}
if(sice==3)
{
fill(0);
rect(340,180,60,20);
rect(400, 200, 20, 60);
rect(340,260,60,20);
rect(400, 280, 20, 60);
rect(340,340,60,20);
}
if(sice==4)
{
fill(0);
rect(320, 200, 20, 60);
rect(400, 200, 20, 60);
rect(340,260,60,20);
rect(400, 280, 20, 60);
}
if(sice==5)
{
fill(0);
rect(340,180,60,20);
rect(320, 200, 20, 60);
rect(340,260,60,20);
rect(400, 280, 20, 60);
rect(340,340,60,20);
}
if(sice==6)
{
fill(0);
rect(340,180,60,20);
rect(400, 200, 20, 60);
rect(340,260,60,20);
rect(400, 280, 20, 60);
rect(340,340,60,20);
rect(320, 280, 20, 60);
}
if(sice==7)
{
fill(0);
rect(340,180,60,20);
rect(400, 200, 20, 60);
rect(400, 280, 20, 60);
}
if(sice==8)
{
fill(0);
rect(340,180,60,20);
rect(400, 200, 20, 60);
rect(340,260,60,20);
rect(400, 280, 20, 60);
rect(340,340,60,20);
rect(320, 280, 20, 60);
rect(320, 200, 20, 60);
}
if(sice==9)
{
fill(0);
rect(340,180,60,20);
rect(400, 200, 20, 60);
rect(340,260,60,20);
rect(400, 280, 20, 60);
rect(340,340,60,20);
// rect(320, 280, 20, 60);
rect(320, 200, 20, 60);
}
90,希望能增加點敘述
回覆刪除