2018年1月20日 星期六

Week07 芷萱的課堂筆記

期中作品介面設計-太鼓達人

  1. 實際去網路上找太鼓達人小遊戲
  2. 擷取遊戲畫面
  3. 加入上方紅色集氣條及計分條與鼓上的連擊數
  4. 加入紅鼓與藍鼓
  5. 加入遊戲提示按下 " Q鍵結算分數 "
  6. 匯入下方遊戲行進中動畫
程式碼:
PImage A;
PImage red;
float rx=800, ry=160;
int bx=800, by=160;
float []dx=new float [100];
int []dy=new int [100];
int Score=0;
int shift=0;
boolean  state=true;
PImage home;
PImage setting;
PImage drum;
PImage blue;
int user=120;
void setup()
{
  size(800, 600);
  A=loadImage("A.png");
  home= loadImage("home.png");
  setting= loadImage("setting.png");
  drum= loadImage("drum.png");
  red=loadImage("red.png");
  blue=loadImage("blue.png");
  image(A, 0, 0, width*1, height*1);
  for (int i=0; i<100; i++)
  {
    dx[i]=random(2000);
    dy[i]=int(random(2));
  }
  frameRate(60);
}
void draw()
{
    image(A, 0, 0, 800, 600);

    for (int i=0; i<100; i++)
    {
      if (dx[i]-shift<0) continue;
      if (abs(dx[i]-shift-20)<5&&mousePressed)

        Score++;

      if (dy[i]==0) drum1(int(dx[i])-shift);
      if (dy[i]==0) drum2(int(dx[i])-shift);
    }
    shift+=3;
    fill(255, 0, 0);
    textSize(50);
    text(Score, 60, 198);
    println("mouse :"+mouseX+" "+mouseY);
}

沒有留言:

張貼留言