2019年10月31日 星期四

呼嚕嚕的p語言日記-week08

1.早八老師解答同學問題:FB社團
2.接杯子程式碼
PVector [] cup=new PVector[3];
PVector [] cupV=new PVector[3];
int guess;
void setup(){
  size(400,300);
  for(int i=0;i<3;i++){
    cup[i]=new PVector (100+i*100,100);
    cupV[i]=new PVector (random(4),random(3));
 

  }
  guess= int (random(3));
  println(guess);
}
class Cup{
    PVector pos;
    PVector v;
    boolean coin=false;
    Cup(float x,float y){
        //pos=new PVector(x,y);
        //v=new PVector(random(4),random(3));
    }
 
 
}
void draw(){
   background(255);
   for(int i=0;i<3;i++){
     cup[i].add(cupV[i]);
    if(cup[i].x<0 || cup[i].x>400) cupV[i].x *=-1;
    if(cup[i].y<0 || cup[i].y>300) cupV[i].y *=-1;
    fill(255);
    ellipse(cup[i].x,cup[i].y,90,60);
    }


沒有留言:

張貼留言

alanhc 互動技術-week17 [final]

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