顯示具有 hw07 標籤的文章。 顯示所有文章
顯示具有 hw07 標籤的文章。 顯示所有文章

2015年1月25日 星期日

期中作品

利用滑鼠左右移動控制橫軸,把圈圈打完就過關並可挑戰下一關。
影片網址:https://www.youtube.com/watch?v=PByHh-evRHw

2015年1月11日 星期日

2014年11月18日 星期二

第七周其中作品展示

https://www.youtube.com/watch?v=Rq1K95eGr0c

雖然最後完整版沒有做出來
但是至少全部都是靠自己的力量寫的
真的有進步了! 下次再加油!

2014年10月27日 星期一

期中作品



https://www.youtube.com/watch?v=1vo1wq8xrik&feature=youtu.be

期中作品

期中作品:井字遊戲


01160324  何彥澤

01163086  謝明翰

01163061  呂銘昇

期中作品


期中作品

https://www.youtube.com/watch?v=XEW0qe27rpQ

成員:01160394溫庭豐  01160766吳逸凡

遊戲介紹及玩法:
這是一個賽車的小遊戲,可以透過鍵盤的上下左右來控制車子位置,這個遊戲就是控制車子來躲避其他的車子,隨著躲避車子的時間增加,分數也就會越來越高,然後只要碰到其他的車子就遊戲結束。

程式碼:
PImage car[]=new PImage[4];
float carX[]={0,0,0,400},carY[]={0,0,0,300};
void setup(){
  size(900,500);
  for(int i=0;i<4;i++) car[i]=loadImage("car"+(i+1)+".png");
  for(int i=0;i<3;i++){ carX[i]=int(random(7))*100+100; carY[i]=-random(400);}
}
int gameOver=0;
int score=0;
void draw(){
   
  /*textSize(20);
    fill(250, 160, 0);
    text("Click to Start!", floor(900/3), floor(500/2)); 
    */
  if(gameOver>0){
    for(int i=0;i<3;i++){ carX[i]=int(random(7))*100+100; carY[i]=-random(400);}
    fill(255,0,0,1); rect(0,0,900,500);gameOver--; 
    score=0;
    textSize(100);
    fill(255, 0, 0);
    text("GameOver!!", floor(200), floor(200));     
    carX[3]=400;
    carY[3]=300;
    return;
    }
  
    background(254,235,156);
    for(int i=1;i<=7;i++){
      if(i%2==1) fill(77);
      else fill(111);
      rect(i*100,0,100,500);
      
      textSize(15);
      fill(255, 0, 0);
      text("Score:"+score, floor(0), floor(100));     
    }
    for(int i=0;i<3;i++)  image(car[i],carX[i],carY[i],100,150);
    image(car[3],carX[3],carY[3],100,150);
    for(int i=0;i<3;i++){
      carY[i]+=5;
      if(carY[i]>500){carY[i]=-random(100); carX[i]=int(random(7))*100+100;}
      if(carX[i]==carX[3] && abs(carY[i]-carY[3])<130) gameOver=300;
     
    }
     score+=3;
//    if(frameCount%60==0)score+=1;
}


void keyPressed(){
  if(keyCode==RIGHT &&carX[3]<700) carX[3]+=100;
  if(keyCode==LEFT &&carX[3]>100) carX[3]-=100;
  if(keyCode==UP && carY[3]>200) carY[3]-=100;
  if(keyCode==DOWN && carY[3]<400)carY[3]+=100;
}

期中作品

https://www.youtube.com/watch?v=5zho8LnjlQs&feature=youtu.be

期中作品_翻牌遊戲

期中作品  翻牌遊戲 :








組員:

  丁思芸 鄭秝安

期中 Demo影片

期中作品:Doodle jump
傅紹捷   張芷瑜


Demo   影片:

期中作品

https://www.youtube.com/watch?v=l2D0a0NsxNI&feature=youtu.be

       羅立皓 陳俊豪


Week07期中作品展示

期中作品

殺螞蟻遊戲Demo



遊戲介紹:

    我做的是殺螞蟻的遊戲,程式執行後遊戲即開始,螞蟻會從視窗下方跑出來,可以用滑鼠的殺蟲劑去消滅,每消滅一隻就會得五分,如果沒消掉讓螞蟻跑走就會扣五分,遊戲時間60秒,結束後會出現你所獲得的成績。


程式:

int antx=0, anty=0, anty1=0, anty2=0;
int score=0;//分數
int lasttime=60;//時間
PImage imgBG, imgHANT, imgUP, ant;//背景、殺蟲劑、螞蟻
void setup(){
  size(380,600);
  ant = loadImage("ant.png");
  imgHANT = loadImage("hant.png");
  imgBG = loadImage("BG.png");
  imgBG.resize(380, 600);
  imgUP = loadImage("up.png");
  imgSTOP = loadImage("stop.png");
  imgSTOP.resize(50, 50);
  imageMode(CENTER);
}
void draw(){
  background(imgBG);
  image(imgHANT, mouseX, mouseY, 120, 60);
  image(imgUP, 190, 20);
  image(imgSTOP, 190, 20);


  anty-=3;
  image(ant,antx+300,anty+600,80,80);
  if(anty+600<0)
  {
    score-=5;
    anty=0;
  }
  anty1-=2;
  image(ant,antx+200,anty1+500,80,80);
  if(anty1+500<0)
  {
    score-=5;
    anty1=0;
  }
  anty2-=3;
  image(ant,antx+100,anty2+700,80,80);
  if(anty2+700<0)
  {
    score-=5;
    anty2=0;
  }

  world();
}
void mousePressed(){
  if (mouseX > antx+300 && mouseX< antx+400 && mouseY<anty+700 && mouseY>anty+600)
   {
     anty=600;
     score+=5;
   }

  if (mouseX > antx+200 && mouseX< antx+300 && mouseY<anty1+600 && mouseY>anty1+500)
   {
   anty1=500;
   score+=5;
   }
  if (mouseX > antx+100 && mouseX< antx+200 && mouseY<anty2+800 && mouseY>anty2+700)
   {
   anty2=700;
   score+=5;
   }
}
void world()
  {
     textFont(createFont("Georgia", 30));
      fill(255);
  text("score:"+score, 25, 30);

  textFont(createFont("Georgia", 30));
      fill(255);
  text("Time:"+lasttime, 250, 30);
  lasttime=60-millis()/1000;

      if(lasttime==0)
      {
      stop();
      textFont(createFont("Georgia", 40));
      background(#FAC17C);
      fill(255,255,255);
      text("Game Over",80,200);
      text("Your score:"+score,40,250);
   
      }
  }

期中作品


期中作品


期中作品Week07


小遊戲:打蚊子
https://www.youtube.com/watch?v=3jJvwQZ4Gzs&feature=youtu.be
炎炎夏日蚊子們出擊~
要來消滅可惡的蚊子們~~

遊戲規則:
用滑鼠控制手去打蚊子們,
在一分鐘內來拯救圖片裡的人們,
時間結束後計算分數,
蚊子消滅就贏了。






遊戲開始畫面


遊戲結束畫面



Week07 期中作品展示

1. 選票的用法 (一定要畫星星, 寫簡評, 自己要圈起來/不能評哦, 同組的你要幫他們標示起來)
2. 影片, 上傳 youtube 之後, 貼在blog

期中作品

圖中人物必須一直踩著橫桿往上跳
一掉下去即 GameOver

import ddf.minim.*;
import processing.serial.*;
PImage img, over;

float myImgY;
float myImgX=320;
float mySpeed=15;
PImage myBackGround;
PImage[] myfloor=new PImage [5];
float[]  myFloorX=new float[5];
float[]  myFloorY=new float[5];
AudioPlayer player2;
Minim m;
void setup()
{
  m=new Minim(this);
    player2=m.loadFile("back.mp3");
   myBackGround=loadImage("bg.jpg");
   over = loadImage("gameover.jpg");
   for (int i=0;i<5;i++) {
     myfloor[i]=loadImage("Floor.jpg");
     myFloorX[i]=random(370);
     myFloorY[i]=random(100)+i*100;
   }
  img=loadImage("img.png");
  size(400, 600);
  myImgY=380;
  over=loadImage("gameover.jpg");
}

void draw()
{
   
  player2.play();
  background(myBackGround);
  image(img, myImgX, myImgY, 100, 100);
  myImgY-=mySpeed;
  mySpeed-=0.5;
  if(myImgY>600)
    image(over, 0, 0, 400, 600);
  //if (myImgY>400) {
   // myImgY=380;
   // mySpeed=25;
  //}
  for (int i=0;i<5;i++) 
  {
    myFloorY[i]+=2;
    image(myfloor[i], myFloorX[i], myFloorY[i], 100, 30);
    if (myFloorY[i]>600) {
      reset(i);
    }
    if (mySpeed<0 && myImgX>myFloorX[i] && myImgX<myFloorX[i]+100 &&  
      myImgY>myFloorY[i] && myImgY<myFloorY[i]+30 )
    {
      touch();
    }
  }
  }

void reset(int i)
{
  myFloorY[i]=random(100);
  myFloorX[i]=random(370);
}
void touch()
{
  mySpeed=15;
}
void keyPressed()
{
  if(keyCode == LEFT)
    myImgX -= 50;
  if(keyCode == RIGHT)
    myImgX += 50; 

}

01160235_謝采玲, HW07, Week07

期中作業

影片:



youtube網址:
https://www.youtube.com/watch?v=eM2tuxL7XDI&feature=youtu.be

[賽車]
●(上)=>前進
●(下)=>倒車
●(左)=>左轉
●(右)=>右轉
●吃到錢=>加100分
●吃到炸彈=>扣100分
●限時60秒
●時間到後=>顯示分數

import ddf.minim.*;
Minim minim;
AudioPlayer m;

PImage imgBG,money,bomb;
//int table[][]= new int [800][510];
float angle=0, carX=400, carY=190, gas=0;
int countDown=60*50;
int s=0;
int mX[]= new int [10];//{50,50,550,700,680,550,600,100,180,200};
int mY[]= new int [10];//{50,150,40,60,180,300,430,500,400,100};
int bX[]= new int [10];
int bY[]= new int [10];

void setup() {
 
  minim= new Minim(this);
  m= minim.loadFile("music.mp3");
  m.rewind();
  m.play();

  size(800,510);

  imgBG=loadImage("background.png");
  //background(imgBG);
  //$'s announce
  money = loadImage("Dollarbills0.png");
  bomb = loadImage("Bomb.png");

  imgBG.resize(800,510);

  mX[0]=50;
  mX[1]=50;
  mX[2]=550;
  mX[3]=700;
  mX[4]=700;
  mX[5]=600;
  mX[6]=550;
  mX[7]=200;
  mX[8]=500;
  mX[9]=200;

  mY[0]=50;
  mY[1]=150;
  mY[2]=100;
  mY[3]=150;
  mY[4]=400;
  mY[5]=40;
  mY[6]=300;
  mY[7]=100;
  mY[8]=450;
  mY[9]=400;

  bX[0]=330;
  bX[1]=330;
  bX[2]=330;
  bX[3]=330;
  bX[4]=600;
  bX[5]=700;
  bX[6]=350;
  bX[7]=180;
  bX[8]=180;
  bX[9]=100;

  bY[0]=140;
  bY[1]=160;
  bY[2]=180;
  bY[3]=200;
  bY[4]=200;
  bY[5]=300;
  bY[6]=420;
  bY[7]=300;
  bY[8]=15;
  bY[9]=180;

  /*
  loadPixels();
  for(int i=0;i<pixels.length;i++){
      color now= pixels[i];
      if(green(now)>red(now))
      {
        pixels[i]=color(255,0,0);
      }
  }
  */

  rectMode(CENTER);//turn point in center
  //updatePixels();
}

/*
//draw startline
void startline(){
  stroke(0);
  strokeWeight(4);
  line(300,150,300,220);
}
*/

void draw() {
  //countdowner
  countDown--;
  background(imgBG);

  //startline();

  //show $'s image
  image(money,mX[0],mY[0],25,25);
  image(money,mX[1],mY[1],25,25);
  image(money,mX[2],mY[2],25,25);
  image(money,mX[3],mY[3],25,25);
  image(money,mX[4],mY[4],25,25);
  image(money,mX[5],mY[5],25,25);
  image(money,mX[6],mY[6],25,25);
  image(money,mX[7],mY[7],25,25);
  image(money,mX[8],mY[8],25,25);
  image(money,mX[9],mY[9],25,25);

  //show b's image
  image(bomb,bX[0],bY[0],25,25);
  image(bomb,bX[1],bY[1],25,25);
  image(bomb,bX[2],bY[2],25,25);
  image(bomb,bX[3],bY[3],25,25);
  image(bomb,bX[4],bY[4],25,25);
  image(bomb,bX[5],bY[5],25,25);
  image(bomb,bX[6],bY[6],25,25);
  image(bomb,bX[7],bY[7],25,25);
  image(bomb,bX[8],bY[8],25,25);
  image(bomb,bX[9],bY[9],25,25);

  //show "Time="
  textSize(32);
  fill(255);
  text("Time=", 20, 30);

  //show time
  textSize(30);
  fill(255,0,0);
  text(countDown/50,150,30);

  //show "score="
  textSize(32);
  fill(255);
  text("Score=", 600, 30);

  //show score
  textSize(30);
  fill(250,0,0);
  text(s,715,30);

  //if time==0
  if(countDown==0)
  {
    minim.stop();
    background(255,0,0);
    textSize(30);
    fill(0,0,0);
    text("Game Over",300,200);
    text("Score is",300,250);
    textSize(80);
    text(s,350,350);
    carX=1000;
    carY=1000;
    noLoop();
  }

  car();
  poim();
  poib();

}

void keyPressed() {

  if(keyCode==UP)
  {
    gas+=2;
    if(gas>5)
    gas=5;
  }
  if(keyCode==RIGHT) angle+=0.1;
  if(keyCode==LEFT) angle-=0.1;
  if(keyCode==DOWN)
  {
    gas-=2;
    if(gas<-5)
    gas=-5;
  }
}

//draw car
void car(){
  translate(carX, carY);
  rotate(angle);
  fill(#0E7C26);
  rect(0, 0, 25, 10);
  fill(#E7F711);
  rect(10, 0, 5, 10);

  carX+=gas*cos(angle);
  carY+=gas*sin(angle);
  if(gas>0)
  {
    gas-=0.1;
    if(gas<0) gas=0;
  }
}

//eat money
void poim(){
  for(int i=0;i<10;i++)
  {
    if((carX>mX[i]&&carX<mX[i]+25)&&(carY>mY[i]&&carY<mY[i]+25))
    {
      mX[i]=1000;
      mY[i]=1000;
      s+=100;
    }
  }
}

//eat bomb
void poib(){
  for(int i=0;i<10;i++){
    if((carX>bX[i]&&carX<bX[i]+25)&&(carY>bY[i]&&carY<bY[i]+25))
    {
      bX[i]=1000;
      bY[i]=1000;
      s-=100;
    }
  }
}

期中作品:SmashBird20s (粉碎小鳥20秒) 遊戲影片

SmashBird20s


組員:張哲鳴,包世宇

遊戲簡介:
一款用Processing寫的小遊戲,操作簡單,但難度相當高,目前沒人能破最高分24分。

操作說明:
按下Space空白鍵 [開始遊戲] 計分
視窗內點擊滑鼠左鍵 即可操控柱子擊殺小鳥!
若想在遊戲中重新計分,可直接按[R]進行重新遊戲。

規則註解:
小鳥飛行速度會隨分數高低有所起伏,Miss會扣分,同時並且減速。

程式大略構思與過程:
1.背景
2.中景
3.前景
4.遊戲規則制訂:分數計算
5.飛行速度參數細節微調
6.最後加入音效
7.雛型成品完成
8.尋找多人實際遊戲測試 DeBug
9.接收建議,並改善遊戲體驗    例: Restar按鈕,擊殺位置微調
10.最終錄製影片 繳交期中作業

遊戲載點:

Windows_64bit: http://ppt.cc/TBmg
Mac_OSX:http://ppt.cc/-PoU

期中作品

組員: 01160741 王奕勝
          01160723 邱詠縉

遊戲名:跳跳火柴人

玩法:
這是一款訓練反應的小遊戲
按下任意鍵可以開始遊戲
按滑鼠左鍵或是空白鍵可以跳躍
越過障礙物可得一分
碰到障礙物則結束遊戲

https://www.youtube.com/watch?v=cu6KQay9WsQ&feature=youtu.be

people p = new people();
wall[] w = new wall[3];
boolean end=false;
boolean intro=true;
int score=0;


void setup()
{
  size(550, 750);
  for (int i = 0; i<3; i++)
  {
    w[i]=new wall(i);
  }

  strokeWeight(5);
}

void draw()
{
  background(255);
  if (end)
  {
    p.move();
  }
  p.people();
  if (end)
  {
    p.drag();
  }
  p.checkCollisions();
  for (int i = 0; i<3; i++)
  {
    w[i].drawwall();
    w[i].checkPosition();
  }
  fill(255);
  stroke(0);

  textSize(32);
  if (end)
  {
    rect(20, 20, 100, 50);
    fill(0);
    text(score, 30, 58);
  } else
  {
    rect(150, 100, 230, 50);
    rect(150, 200, 200, 50);
    fill(0);
    if (intro)
    {
      text("Press space or", 155, 140);
      text("Click to Play", 155, 240);
    } else
    {
      text("Game over", 170, 140);
      text("Score", 180, 240);
      text(score, 280, 240);
    }
  }
}

class people
{
  float xPos, yPos, ySpeed;
  people()
  {
    xPos = 250;
    yPos = 400;
  }

  void people()//people
  {
    fill(0, 0, 128);
    ellipse(xPos+5, yPos+40, 30, 30);
    rect(xPos, yPos+55, 10, 25); //body

    rect(xPos+5, yPos+60, 20, 5); //right hand
    rect(xPos+20, yPos+50, 5, 10); //right hand

    rect(xPos+5, yPos+75, 20, 5); //right feet
    rect(xPos+20, yPos+80, 5, 12); //right feet

    rect(xPos-15, yPos+60, 20, 5); //left hand
    rect(xPos-15, yPos+65, 5, 7); //left hand

    rect(xPos-15, yPos+75, 20, 5); //left feet
    rect(xPos-15, yPos+80, 5, 12); //left feet
  }

  void jump()
  {
    ySpeed=-10;
  }

  void drag()
  {
    ySpeed+=0.4;
  }

  void move()
  {
    yPos+=ySpeed;
    for (int i = 0; i<3; i++)
    {
      w[i].xPos-=3;
    }
  }

  void checkCollisions()
  {
    if (yPos>750)
    {
      end=false;
    }
    for (int i = 0; i<3; i++)
    {
      if ((xPos<w[i].xPos+15&&xPos>w[i].xPos-15)&&(yPos<w[i].wallY-125||yPos>w[i].wallY+20))
      {
        end=false;
      }
    }
  }
}

class wall
{
  float xPos, wallY,xObj;
  boolean cashed = false;
  wall(int i)
  {
    xPos = 100+(i*200);  
    wallY = random(500)+100;
  }

  void drawwall()
  {
 
    stroke(255,0,0);
 
    line( xPos, 0, xPos, wallY-100);
    line( xPos, wallY+100, xPos, 750);
 
  }

  void checkPosition()
  {
    if (xPos<0)
    {
      xPos+=(200*3);
      wallY = random(600)+100;
      cashed=false;
    }
    if (xPos<250&&cashed==false)
    {
      cashed=true;
      score++;
    }
  }
}

void reset()
{
  end=true;
  score=0;
  p.yPos=400;
  for (int i = 0; i<3; i++)
  {
    w[i].xPos+=550;
    w[i].cashed = false;
  }
}

void mousePressed()
{
  p.jump();
  intro=false;
  if (end==false)
  {
    reset();
  }
}

void keyPressed()
{
  p.jump();
  intro=false;
  if (end==false)
  {
    reset();
  }
}