2020年10月19日 星期一

weeeeek05

 PART 1

size(500,400);

rect(100,100,200,100);

fill(255,0,0);

textSize(40);

text("Hello",100,100);

PART 2

設定上改細明體


PART 3


int [][]A={{1,1,1},
           {0,1,0},
           {0,1,1},
           {1,1,1}};
              
size(300,400);
for(int i=0;i<4;i++)
{
  for(int j=0;j<3;j++)
  {
    if(A[i][j]==0) fill(0);
    else fill(255,255,0);
    
    rect(j*100,i*100,100,100);
  }
}
PART 4
int [][]A={{1,2,2,2},
           {0,1,1,1},
           {0,1,1,1},
           {2,2,2,2}};
PImage bear,tiger;
void mousePressed()
{
  int i = int(mouseY/100);
  int j = int(mouseX/100);
  A[i][j]=0;
}
void setup()
{
  size(400,400);
  bear=loadImage("bear.png");
  tiger=loadImage("tiger.png");
}
void draw()
{
  background(0);
  for(int i=0;i<4;i++)
  {
    for(int j=0;j<4;j++)
     {
       if(A[i][j]==1) image(bear,j*100,i*100,100,100);
       if(A[i][j]==2) image(tiger,j*100,i*100,100,100);
     }
  }
  ellipse(mouseX,mouseY,25,25);
  text("mouseX:"+mouseX + "mouseY:" + mouseY,100,100);
}


沒有留言:

張貼留言