2014年4月28日 星期一

第八周上課內容

1.開始文字與圖片:
if (countDown1>0)
  {
    background(start);
    countDown1--;
    image(img13, 60, 28);
    text(countDown1/30, 100, 50);
    textSize(20);  
    text("Welcome to Maldives Islands!", 50, 100);
    text("Here has the deep blue sea and wonderful landscape.", 70, 130);
    text("Please enjoy your trip of undersea explorer.", 70, 148);

    image(deit, 170, 170);
    return;
  }
2.規則設計
3.追蹤手部位置放圖(漁網)
    img0=loadImage("C:/Users/Jean/Desktop/fish/w.png");
   int fingers=hand.countFingers();
    if (fingers==0||fingers==1)image(img0, hand_position.x, hand_position.y-34);
4.雖機出現魚種類&位置
 which_fish=int (random(11));
      fishX=random(620);
      // fishXX=random(700);
      fishY=random(400);
      // fishYY=random(400);
5.判斷是否打到該魚並加減分
if (showpic==1)
    {
      if (which_fish==1)
      {
        image(img1, fishX, fishY);
        //image(img7, fishXX, fishYY);
        if ((money==1)&& (dist(fishX, fishY, myHand.x, myHand.y) < 20)&&(dist(fishX, fishY, myHand.x, myHand.y) >0) )
        {
          money=0;
          showpic=0;
          score++;
          println(score);
        }
      }
6.結束遊戲分數太低(<20)
if (lhert<=0&&score<20||countDown2<0&&score<20)
  {
    if(fin)a=2;
    background(end);
    textSize(32);
    text("YOU ARE LOSER !", 50, 100);
    text("Pleasw try again !", 70, 170);
    text("YOUR SCORE="+score, 150, 400);
    endgame=1;
    fin=false;
   
  }
7.結束遊戲分數>20
 if (lhert<=0&&score>20||countDown2<0&&score>20)
  {
    if(fin)a=3;
    background(end);
    textSize(32);
    text("YOU ARE WINNER !", 50, 100);
    text("It is evening now.", 70, 170);
    text("please enjoy the beautiful view and take a rest.", 70, 220);
    text("We wish you can come back very soon!", 70, 270);
    text("Wish you have a pleasant journey.", 70, 320);
    text("YOUR SCORE="+score, 150, 400);
    endgame=1;
    fin=false;
   
  }

沒有留言:

張貼留言