顯示具有 08160520_石雅慈 標籤的文章。 顯示所有文章
顯示具有 08160520_石雅慈 標籤的文章。 顯示所有文章

2022年1月4日 星期二

鴨力山大-最終成品

以下是有使用到的圖片

這是背景圖

這是遊戲主角






這14張圖是用來做gif圖(會呈現在死亡畫面)

成品的影片


以下是程式碼

PImage img1,img2;
PImage[] img3 = new PImage[14];//死亡畫面的陣列
float x=155,y=300,vx=0,vy=0;//女孩
boolean jumping=false;
boolean alive=true;
float []tofuX=new float[100];
float []tofuVX=new float[100];
int n=1;//豆腐數量
int state=0;
int tofuH=0;//畫面滾動的高度
int t=0;
PFont timberman;
void setup(){
  size(400,600);
  
  img1=loadImage("bgg.JPG");
  img2=loadImage("111.png");
  
  img3[0]  = loadImage("1111.gif");
  img3[1]  = loadImage("2222.gif");
  img3[2]  = loadImage("3333.gif");
  img3[3]  = loadImage("4444.gif");
  img3[4]  = loadImage("5555.gif");
  img3[5]  = loadImage("6666.gif");
  img3[6]  = loadImage("7777.gif");
  img3[7]  = loadImage("8888.gif");
  img3[8]  = loadImage("9999.gif");
  img3[9]  = loadImage("1010.gif");
  img3[10]  = loadImage("1011.gif");
  img3[11]  = loadImage("1012.gif");
  img3[12]  = loadImage("1013.gif");
  img3[13]  = loadImage("1014.gif");///這些圖片是不斷讀取才會有gif圖的感覺
  tofuX[0]=140;//豆腐剛開始的位子
  generateTofu();//呼叫產生豆腐的函式
}
int k=0;
void draw(){
  image(img1,0,0,400,600);
  timberman = createFont("Pixelony.ttf", 40);//遊戲字體
  text("Score:"+(n-1),130,100);
  textFont(timberman);
  for(int i=0;i<n;i++)
  {
    rect(tofuX[i],400-i*65+tofuH,125,65);
  }
  if(state==1){
    if(t>0){
      tofuH++;t--;
    }else{
      state=0;
      
    }
  }
  
  image(img2,x,y+tofuH,100,100);
  if(jumping){
    if(vy>0 && tofuX[n-1]<x+70 && x<tofuX[n-1]+95 && y+100<400-(n-1)*65 && y+100+vy>400-(n-1)*65){//女孩可以掉落的範圍
      jumping=false; vy=0; y=400-(n-1)*65-100;
      screenroll();
      generateTofu();
    }else{
      y+=vy;
      vy+=0.98;//重力
    }
  }
  tofuX[n-1]+=tofuVX[n-1];
  
  if(!jumping && tofuVX[n-1]!=0 && tofuX[n-1]<x+75 && x<tofuX[n-1]+100){//碰到女孩的範圍
    
    alive=false;
  }
  if(y>600)//掉落到畫面外導致死亡
  {
    alive=false;
  }
  if(alive==false)//死亡
  {
    image(img3[k],0,0,400,600);
    if(frameCount%6==0) k=(k+1)%14;
    timberman = createFont("Pixelony.ttf", 40);//遊戲字體
    text("Your Score:"+(n-1),70,100);//顯示分數
    fill(#EA2F4B);
    textFont(timberman);
  }
}

void mousePressed(){
  if(!jumping){  
    jumping=true;
    vy=-22;//跳躍的高度
  }
}

void generateTofu(){//做出豆腐的函式
  int dir=int(random(2));//0=左邊,1=右邊
  n++;
  if(dir==0){
    tofuX[n-1]=400;
    tofuVX[n-1]=-2;//豆腐移動的速度
  }else{
    tofuX[n-1]=-125;
    tofuVX[n-1]=2;//豆腐ˇ移動的速度
  }
 
}
void screenroll(){//畫面滾動的函式
  state= (state+1)%2;
  if(state==0){
   
  }else if(state==1){
    t+=65;
  }
}






2022年1月3日 星期一

鴨力山大week12(期末作品第二步)


 新進展!!!可以成功疊加豆腐,女孩也可以成功站在豆腐上
下次要做出分數跟死亡畫面

以下是這周的程式碼

PImage img1;
float x=203,y=370,vx=0,vy=0;//女孩的座標
boolean jumping=false;
float []tofuX=new float[100];
float []tofuVX=new float[100];
int n=1;//豆腐數量
int state=0;//0是不會動,1是豆腐移動,2是豆腐停止且往下降
int tofuH=0;
int t=0;

void setup(){
  size(400,600);
  img1=loadImage("bgg.JPG");
  tofuX[0]=140;//豆腐剛開始的位子
  generateTofu();//做出新豆腐
}
void draw(){
  image(img1,0,0,400,600);
  for(int i=0;i<n;i++)
  {
    rect(tofuX[i],400-i*65+tofuH,125,65);
  }
  if(state==1){
    if(t>0){
      tofuH++;t--;
    }else{
      state=0;
      
    }
  }
  tofuX[n-1]+=tofuVX[n-1];
  ellipse(x,y+tofuH,60,60);
  if(jumping){
    if(vy>0 && tofuX[n-1]<x && x<tofuX[n-1]+125 && y+33<400-(n-1)*65 && y+33+vy>400-(n-1)*65){///設定出一個範圍,讓女孩站在豆腐上面
      jumping=false; vy=0; y=400-(n-1)*65-30;
      screenroll();
      generateTofu();
    }else{
      y+=vy;
      vy+=0.98;//重力
    }
  }
}
void mousePressed(){
  if(!jumping){  
    jumping=true;
    vy=-24;//跳躍高度的設定
  }
}
void keyPressed(){
  generateTofu();
}
void generateTofu(){///做出新的豆腐的函式
  int dir=int(random(2));//0=左邊,1=右邊
  n++;
  if(dir==0){
    tofuX[n-1]=400;
    tofuVX[n-1]=-2;//移動的速度
  }else{
    tofuX[n-1]=-125;
    tofuVX[n-1]=2;//移動的速度
  }
}
void screenroll(){///整個畫面滾動的函式
  state= (state+1)%3;
  if(state==0){
   
  }else if(state==1){
    t=65;
  }
}

鴨力山大week11(期末作品第一步)


期末作品要做豆腐女孩!!!!

以下是這周程式碼的進度,還沒有辦法成功跳上去豆腐也很不聽話

PImage img1;
float []tofuX=new float[100];
int n=0;//豆腐數量
int tofuDir=0;//豆腐方向1 -1
int tofuH=0;
int state=0;//0是不會動,1是豆腐移動,2是豆腐停止且往下降
int t=0;
float gx=203,gy=370,vx=0,vy=0;
boolean jumping=false;
void setup(){
  size(400,600);
  img1=loadImage("bgg.JPG");
  //for(int i=0;i<100;i++) tofuX[i] = random(100,200);
}
void draw(){
  image(img1,0,0,400,600);
  fill(#D7DCE0);
  rect(142,400+tofuH,125,65);//底座
  for(int i=0;i<n;i++){
    rect(tofuX[i],335-i*65+tofuH,125,65);
  }
  if(state==1){//移動豆腐的程式碼
    tofuX[n-1]+=tofuDir;
  }else if(state==2){
    if(t>0){
      tofuH++;t--;
    }else state=3;
  }
  fill(#88BDD8);ellipse(gx,gy,60,60);
  if(jumping){
    gx += vx; gy += vy; vy += 0.98;//重力
    if(gy>370){
      gy=370;jumping=false;
    }
    if(n>0)
    {
      float tofuY=335-(n-1)*65+tofuH;
      if( tofuX[n-1]<gx && gx<tofuX[n-1]+125 && tofuY<gy && gy<tofuY+65 ){//夾在中間
        if(state!=2) changeState();
      }
    } 
  }
  
  
}
void mousePressed(){
    jumping=true;
    vy=-16;
}
void keyPressed(){
  changeState();
}
void changeState(){
  state= (state+1)%3;
  if(state==0){
  
  }else if(state==1){
    tofuDir=int(random(2));//0,1
    if(tofuDir==0) tofuDir=-1;
    //假設random取出數是0,因為方向是1跟-1,所以要將0變成-1
    n++;
    if(tofuDir==1) tofuX[n-1]=-125;//最左邊
    if(tofuDir==-1) tofuX[n-1]=400;//最右邊
    
  }else if(state==2){
    t=65 ;
  }
  
}


 

2021年11月29日 星期一

鴨力山大week08

 


製作會動的小人~~

程式碼如下
PImage img;
void setup(){
  size(500,500);
  img=loadImage("img.jpg");
  imageMode(CENTER);
}
int a=0, b=0, x=250, y=250;
void draw(){
  background(255);
  //image( img, 0,0);
  image(  img.get(141*a, 211*b, 141,211), x,y);
  if(frameCount%30==0) a = (a+1)%4;
}
void keyPressed(){
  if(keyCode==RIGHT){ b=3; x++; }
  if(keyCode==LEFT) { b=2; x--; }
  if(keyCode==UP) { b=1; y--; }
  if(keyCode==DOWN){ b=0; y++; }
}

記得要去下載圖片~





2021年11月22日 星期一

鴨力山大week07

 


float x=250,y=250,vx=0,vy=3;

void setup(){

  size(500,600);

}

void draw(){

  background(255);

  ellipse(x,y,50,50);

  // y=y+3;///3是速度

  y=y+vy;

}


float x=250,y=0,vx=0,vy=3;
float x2=150,y2=50,vx2=0,vy2=2;
void setup(){
  size(500,600);
}
void draw(){
  background(255);
  ellipse(x,y,50,50);
  ellipse(x2,y2,50,50);
  // y=y+3;///3是速度
  y=y+vy;
  y2=y2+vy2;
}



//很多組
float []x={250,150,350,300};
float []y={0,50,80,100};
float []vx={0,0,0,0};
float []vy={3,2,2.5,4};
void setup(){
  size(500,600);
}
void draw(){
  background(255);
  for(int i=0;i<4;i++){
    ellipse(x[i],y[i],50,50);
    y[i] = y[i]+vy[i];//vy是速度
  }
}

可以讓球碰到牆反彈

//很多組又多一點互動  
float []x={250,150,350,300};
float []y={0,50,80,100};
float []vx={0,0,0,0};
float []vy={3,2,2.5,4};
void setup(){
  size(500,600);
}
void draw(){
  background(255);
  for(int i=0;i<4;i++){
    ellipse(x[i],y[i],50,50);
    y[i] = y[i]+vy[i];//vy是速度
    if(y[i]>600) vy[i] = -vy[i];//撞到下方
    if(y[i]<0)vy[i]=-vy[i];//撞到上方
  }
}

//很多組又多一點互動  
float []x={250,150,350,300};
float []y={0,50,80,100};
float []vx={0,0,0,0};
float []vy={3,2,2.5,4};
void setup(){
  size(500,600);
}
void draw(){
  background(255);
  for(int i=0;i<4;i++){
    fill(255,255,0);ellipse(x[i],y[i],50,50);
    if(dist(mouseX,mouseY,x[i],y[i])<=50){
      continue;
    }
    y[i] = y[i]+vy[i];//vy是速度
    if(y[i]>600) vy[i] = -vy[i];//撞到下方
    if(y[i]<0)vy[i]=-vy[i];//撞到上方
  }
  fill(255,0,0);ellipse(mouseX,mouseY,50,50);
}


這個程式碼可以讓紅球碰到的黃球消失
//很多組又多一點互動  
float []x={250,150,350,300};
float []y={0,50,80,100};
float []vy={3,2,2.5,4};
boolean [] dead={false,false,false,false};
void setup(){
  size(500,600);
}
void draw(){
  background(255);
  for(int i=0;i<4;i++){
    ///fill(255,255,0);ellipse(x[i],y[i],50,50);
    if(dist(mouseX,mouseY,x[i],y[i])<=50){
      dead[i]=true;
    }
    if(dead[i]==true) continue;
    fill(255,255,0);ellipse(x[i],y[i],50,50);
    y[i] = y[i]+vy[i];//vy是速度
    if(y[i]>600) vy[i] = -vy[i];//撞到下方
    if(y[i]<0)vy[i]=-vy[i];//撞到上方
  }
  fill(255,0,0);ellipse(mouseX,mouseY,50,50);
}


因為課堂上有同學不懂boolean 所以寫一個比較易懂的程式碼教學(布林變數)
綠色是不成立,紅色是成立

boolean down;//按下去
void setup(){
  size(500,300);
}
void draw(){
  if(mousePressed) down=true;//成立
  else down=false;//不成立
  print(down);
  if(down) background(255,0,0);//紅色
  else background(0,255,0);//綠色
}




變出隨機的球數
float []x;//外面宣告global陣列變數
float []y;
float []vy;
boolean []dead;
int N=20;
void setup(){
  size(500,600);
  x = new float[N];
  y = new float[N];
  vy = new float[N];
  dead = new boolean[N];
  for(int i=0;i<N;i++){
    x[i] = random(500);//500以下亂數
    y[i] = random(100,200);
    vy[i] = random(3,4);
    dead[i]=false;//沒有死掉
  }
}
void draw(){
  background(255);
  for(int i=0;i<N;i++){
    ///fill(255,255,0);ellipse(x[i],y[i],50,50);
    if(dist(mouseX,mouseY,x[i],y[i])<=50){
      dead[i]=true;
    }
    if(dead[i]==true) continue;
    fill(255,255,0);ellipse(x[i],y[i],50,50);
    y[i] = y[i]+vy[i];//vy是速度
    if(y[i]>600) vy[i] = -vy[i];//撞到下方
    if(y[i]<0)vy[i]=-vy[i];//撞到上方
  }
  fill(255,0,0);ellipse(mouseX,mouseY,50,50);
}




class Ball{
  float x,y,vx,vy;
  boolean dead;
  Ball(){
    x = random(500);
    y = random(100,200);
    vy = random(3,4);
    dead = false;
  }
  void draw(){
    if(dead==true) return;
    ellipse(x,y,50,50);
    if(dist(mouseX,mouseY,x,y)<50){
      dead=true;
    }
    y = y+vy;
    if(y>500) vy = -vy;
    if(y<0) vy = -vy;
  }
}
Ball []balls;
void setup(){
  size(500,500);
  balls = new Ball[20];
  for(int i=0;i<20;i++){
    balls[i]=new Ball();
  }
}
void draw(){
  background(255);
  for(int i=0;i<20;i++){
    balls[i].draw();
  }
}

class Ball{
  float x,y,vx,vy;
  boolean dead;
  Ball(){
    x = random(500);
    y = random(500);
    vy = random(-4,4);
    vx = random(-4,4);
    dead = false;
  }
  void draw(){
    if(dead==true) return;
    ellipse(x,y,50,50);
    if(dist(mouseX,mouseY,x,y)<50){
      dead=true;
    }
    x = x + vx;
    y = y + vy;
    if(y>500||y<0) vy = -vy;
    if(x>500||x<0) vy = -vy;
  }
}
Ball []balls;
void setup(){
  size(500,500);
  balls = new Ball[20];
  for(int i=0;i<20;i++){
    balls[i]=new Ball();
  }
}
void draw(){
  background(255);
  for(int i=0;i<20;i++){
    balls[i].draw();
  }
}


加一個重力加速度

class Ball{
  float x,y,vx,vy;
  boolean dead;
  Ball(){
    x = random(500);
    y = random(500);
    vy = random(-4,4);
    vx = random(-4,4);
    dead = false;
  }
  void draw(){
    if(dead==true) return;
    ellipse(x,y,50,50);
    if(dist(mouseX,mouseY,x,y)<50){
      dead=true;
    }
    x = x + vx;
    y = y + vy;
    vy += 0.98;
    if(y>500||y<0) vy = -vy;
    if(x>500||x<0) vy = -vy;
  }
}
Ball []balls;
void setup(){
  size(500,500);
  balls = new Ball[20];
  for(int i=0;i<20;i++){
    balls[i]=new Ball();
  }
}
void draw(){
  background(255);
  for(int i=0;i<20;i++){
    balls[i].draw();
  }
}


發射子彈,玩家碰到子彈就結束遊戲(變成紅色的畫面)

class Ball{//我們發明 Ball物件
  float x, y, vx, vy;
  boolean dead;
  Ball(){//建構 同名的東西
    reborn();
  }
  void reborn(){
    x = random(500);
    y = random(500);
    vy = random(-2,2);
    vx = random(-2,2);
    dead = false;//沒有死掉
  }
  void draw(){
    if(dead==true) return;
    fill(255,0,0); ellipse(x,y, 5,5);
    if( dist(mouseX,mouseY,x,y)<5 ){
      dead=true;
      gameOver=true;
    }
    x = x + vx*1;//速度*時間=距離
    y = y + vy*1;
    if(y>500 || y<0) reborn();
    if(x>500 || x<0) reborn();
  }
}
Ball [] balls;
void setup(){
  size(500,500);
  balls = new Ball[99];
  for(int i=0; i<99; i++){
    balls[i] = new Ball();
  }
}
boolean gameOver=false;
void draw(){
  background(0);
  for(int i=0; i<99; i++){
    balls[i].draw();
  }
  if(gameOver) background(255,0,0);  
}





2021年11月15日 星期一

鴨力山大week06

size(600,600);//視窗大小
fill(255,0,0);
textSize(80);//字體大小
text("Hello",50,50);


我們可以試著移動字,讓字可以完整被看到
void setup(){
  size(600,600);//視窗大小
  fill(255,0,0);
  textSize(80);//字體大小
}
void draw(){
  text("Hello",50,100);
}


做計時器
void setup(){
  size(600,600);//視窗大小
  fill(255,0,0);
  textSize(80);//字體大小
}
void draw(){
  background(255);
  text("Time:"+frameCount,50,100);
}//每秒60frame,過了幾個frame


void setup(){
  size(600,600);//視窗大小
  fill(255,0,0);
  textSize(80);//字體大小
}
void draw(){
  background(255);
  text("Time:"+frameCount/60,50,100);
  text("millis()"+millis(),50,200);
}//每秒60frame,過了幾個frame
//kilo-meter centi-milli-millis千分之一秒
//km   m     cm    mm
//kg   g           mg


void setup(){
  size(600,600);//視窗大小
  fill(255,0,0);
  textSize(80);//字體大小
}
void draw(){
  background(255);
  text(hour()+":"+minute()+":"+second(),50,100);
  text("millis()"+millis()/1000,50,200);
}//每秒60frame,過了幾個frame
//kilo-meter centi-milli-millis千分之一秒
//km   m     cm    mm
//kg   g           mg


使用println(PFont.list());列出電腦內的字體


顯示中文
PFont myFont;
void setup(){
  size(500,500);
  myFont=createFont("標楷體",100);
  textFont(myFont);
  text("中文",100,100);
}


按著滑鼠可以換字體
PFont font1,font2;
void setup(){
  size(500,500);
  font1 = createFont("標楷體",100);
  textFont(font1);
  font2 = createFont("微軟正黑體 Bold",100);
}
void draw(){
  background(0);
  text("中文",100,100);
  if(mousePressed) textFont(font2);
  else textFont(font1);
}


void setup(){
  size(600,600);
  fill(255,0,0);
  textSize(80);
}
void draw(){
  background(255);
  String hh=nf(hour(),2);
  String mm=nf(minute(),2);
  String ss=nf(second(),2);
  text(hh+":"+mm+":"+ss,50,100);
}




倒數計時
void setup(){
  size(600,600);
  fill(255);//白色的字
  textSize(80);
}
void draw(){
  background(#075BB2);
  String hh=nf(hour(),2);
  String mm=nf(minute(),2);
  String ss=nf(second(),2);
  text("現在:"+hh+":"+mm+":"+ss,50,100);
  text("下課:15:40:00",50,200);
  
  int now = hour()*60*60 + minute()*60 + second();
  int next =15    *60*60 + 40      *60 + 0;
  int remain = next-now;
  text("剩下:"+remain,50,300);
}



倒數計時會轉換成時分秒
void setup(){
  size(600,600);
  fill(255);//白色的字
  textSize(80);
}
void draw(){
  background(#075BB2);
  String hh=nf(hour(),2);
  String mm=nf(minute(),2);
  String ss=nf(second(),2);
  text("現在:"+hh+":"+mm+":"+ss,50,100);
  text("下課:15:40:00",50,200);
  
  int now = hour()*60*60 + minute()*60 + second();
  int next =15    *60*60 + 40      *60 + 0;
  int remain = next-now;
  text("剩下:"+remain,50,300);
  hh = nf(remain/60/60%60,2);
  mm = nf(remain/60%60,2);
  ss = nf(remain%60,2);
  text("剩下:"+hh+":"+mm+":"+ss,50,400);
}




顯示圖片
PImage [] img =new PImage[10];
void setup(){
  size (1120,450);
  for(int i=0; i<10;i++) img[i]=loadImage(i+".png");
}
void draw(){
  for(int i=0;i<10;i++){
    int x =(i%5)*224,y=int(i/5)*225;
    image(img[i],x,y);
  }
}


PImage [] img =new PImage[10];
PFont font;
void setup(){
  
  size(1120,450);
  for(int i=0; i<10;i++) img[i]=loadImage(i+".png");
  fill(255);
  font = createFont("標楷體",80);
  textFont(font);
}
void draw(){
  background(#075BB2);
  String hh=nf(hour(),2);
  String mm=nf(minute(),2);
  String ss=nf(second(),2);
  text("現在:"+hh+":"+mm+":"+ss,50,100);
  text("下課:15:40:00",50,200);
  
  int now = hour()*60*60 + minute()*60 + second();//總秒數
  int next = 16   *60*60 + 40      *60 + 0;//總秒數
  int remain = next-now;//剩下的時間 (秒數來算)
  if(remain<0) remain += 24*60*60;
  text("剩下:"+remain, 50,300);
  hh = nf(remain/60/60%60, 2);
  mm = nf(remain/60%60, 2);
  ss = nf(remain%60, 2);
  text("剩下:"+hh+":"+mm+":"+ss, 50,400);
  int x=800;
  while(remain>0){
    int n = remain%10;
    remain = remain / 10;
    image( img[n], x,100,100,100);
    x-=100;
  }
}



 

2021年11月1日 星期一

鴨力山大week05

 


開啟processing去程式素描本安裝函式庫,去下載video


file-範例-video-movie-loop 然後執行




記得把影片先丟進去,然後打程式

import processing.video.*;
Movie movie;
void setup() {
  size(560, 406);
  movie = new Movie(this, "launch2.mp4");
  movie.loop();
}
void draw(){
  image(movie,0,0);
}
void movieEvent(Movie m){
  m.read();
}


先叫出GettingStartedCapture



import processing.video.*;
Capture cam;
void setup()
{
 size(640,480);
 String[] cameras = Capture.list();
 for(String name : cameras)
 {
   println(name);
 }
}






因為我的攝影機出了一點狀況,可能要換電腦或是重新啟動才可能會成功執行,為了跟上課程所以就先繼續上課
import processing.video.*;
Capture cam;
void setup(){
  size(640,480);
  cam=new Capture(this, 640,480);
  cam.start();
}
void draw(){
   if(cam.available()){
      cam.read(); 
   }
   image(cam,0,0);
}






多一行程式碼,存取連續照片,記得複製此資料夾的位置
import processing.video.*;
Capture cam;
void setup(){
  size(640,480);
  cam= new Capture(this, 640,480);
  cam.start();
}
void draw(){
   if(cam.available())
   {
      cam.read(); 
   }
   image(cam,0,0);
   saveFrame();
}

把圖片存成影片檔,貼上剛剛複製的位置,存在桌面


import processing.video.*;//先裝好 Video Library
Movie movie;

void setup()
{
  size(640,480);
  movie = new Movie(this, "my_webcam.mov");
  movie.loop();
}//要在我的硬碟的目錄裡面,開launch2.mp4檔
void draw()
{
  image(movie,0,0);
}
void movieEvent(Movie m)
{
  m.read();
}

下面是第二種方式
import processing.video.*;//先裝好 Video Library
Movie movie;

void setup()
{
  size(640,480);
  movie = new Movie(this, "my_webcam.mov");
  movie.loop();
}//要在我的硬碟的目錄裡面,開launch2.mp4檔
void draw()
{
  if(movie.available())//第2種方法
  {
    movie.read();//第2種方法
  }
  image(movie,0,0);
}
//void movieEvent(Movie m)
//{
//  m.read();
//}



原本是紅色,點一下滑鼠會變成一般紅色一半綠色

void setup()
{
  size(640,480);
  background(255,0,0);
}
void draw()
{
  println(frameCount);
}
void mousePressed()
{
  loadPixels();
  for(int i=0;i<640*480/2;i++)
  {
    pixels[i]=color(0,255,0);
  }
  updatePixels();
  saveFrame();
}


import processing.video.*;
Movie movie;
color[]c={#F0F0F0,#FFF160,#FFC501,#FE9600,#03001C};

void setup(){
  size(640,480);
  
  movie = new Movie(this,"my_webcam.mov");
  movie.play();
}
void draw(){
  if(movie.available()){
    movie.read();
    image(movie,0,0);
  }
}
void mousePressed(){
  movie.pause();
  loadPixels();
  for(int i=0;i<640*480;i++){
    float bright - brightness(pixels[i]);
    int now = 4-int(bright/67);
    pixels[i] -c[now];
  }
  updatePixels();
}