2019年10月31日 星期四

Week08_Summer

 今日目標:

中作品





 01 目前其中作品的進度


 程式碼:

PImage imgBuilding,imgPixels;
int roleX=0,roleY=0,roleVX=1;
void setup(){
    size(1200,600);
    imgBuilding=loadImage("dreamBuilding.png");
    imgPixels=loadImage("dreamPixels.png");
    imgPixels.loadPixels();
}
void draw(){
  background(imgBuilding);
  int nextX=roleX+roleVX,nextY=roleY;
  if(imgPixels.pixels[nextX+nextY*+600] == color(255)){
    roleX=nextX;
    for(int y=nextY;y<400;y++){
      if(imgPixels.pixels[nextX+y*1200] == color(0)){
        if(abs(roleY-y)>20) background(255,0,0);
        roleY = y-1;
        break;
      }
    }
  }
  ellipse(roleX,roleY,30,30);
}









PImage imgBuilding,imgPixels,imgtoolo;
int roleX=0,roleY=0,roleVX=1;
void setup(){
    size(1200,600);
    imgBuilding=loadImage("dreamBuilding.png");
    imgPixels=loadImage("dreamPixels.png");
    imgtoolo=loadImage("tool1.png");
    imgPixels.loadPixels();
}
void draw(){
  background(imgBuilding);
  image(imgtoolo,232,108,80,70);
  int nextX=roleX+roleVX,nextY=roleY;
  if(imgPixels.pixels[nextX+nextY*+600] == color(255)){
    roleX=nextX;
    for(int y=nextY;y<400;y++){
      if(imgPixels.pixels[nextX+y*1200] == color(0)){
        if(abs(roleY-y)>20) background(255,0,0);
        roleY = y-1;
        break;
      }
    }
  }
  ellipse(roleX,roleY,30,30);
}
void mousePressed(){
  if(mousePressed && mouseButton == RIGHT){
    
  }
}


完成品:











沒有留言:

張貼留言

alanhc 互動技術-week17 [final]

回顧這學期的作品:  期中作業:LANDING:PLANET 賣點&特點: 炫麗的特效 物理(星球重力及降落)及粒子系統(噴射) 世界地圖可根據視角縮放 困難點: 重寫3次最終改寫成物件導向的CLASS寫法...