顯示具有 01160723_邱詠縉 標籤的文章。 顯示所有文章
顯示具有 01160723_邱詠縉 標籤的文章。 顯示所有文章

2015年1月18日 星期日

Week19_期末作品

跳跳火柴人:

玩法:
人需要穿上拖鞋,隨著遊戲人物一起跳躍,穿越障礙物來獲取高分。
開始和重新只需要用力在跳一下,即可再次遊戲。

 p語言:
import processing.serial.*;//
Serial myPort,myPort1;//
import ddf.minim.*;///
Minim minim;///
AudioPlayer bgMusic,jumpMusic,gg;///

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


void setup()
{
  size(550, 750);
  myPort=new Serial(this, "COM4", 9600);//
  minim = new Minim(this);///
  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);
      bgMusic.close();///
    }
  }


  if (myPort.available()>0&&myPort.read()==100)
  {
    p.jump();
    intro=false;
    if (end==false)
    {
      reset();
    }
  }
  /*if (myPort.available()>0&&myPort.read()==97)
  {
    intro=false;
  if (end==false)
  {
    reset();
  }
  }*/
}

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;
    jumpMusic = minim.loadFile("jump.mp3");///
    jumpMusic.play();
  }

  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+45))
      {
        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+130, 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;
  }
  if(over)
    {
      bgMusic = minim.loadFile("bgmusic1.mp3");///
      bgMusic.play();
    }
 
}

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

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

arduino:
void setup(){
  Serial.begin(9600);
  pinMode(2, INPUT_PULLUP);
  pinMode(4, INPUT_PULLUP);
  pinMode(12, OUTPUT); 
  //pinMode(13, OUTPUT); 
}
int a=0;
void loop(){
  int sensorVal = digitalRead(2);
  int sensorVal2 = digitalRead(4);

  if (sensorVal == HIGH) {
    digitalWrite(13, LOW);
  } 
  else {
    digitalWrite(13, HIGH);
    Serial.write(100);
    delay(100);
  }
  
  if(sensorVal2 == LOW)a=0;
  if(sensorVal2 == HIGH && a==0){Serial.write(97); a=1;}
  /*if (sensorVal2 == HIGH) {
    digitalWrite(12, LOW);
  } 
  else {
    digitalWrite(12, HIGH);
    Serial.write(65);
    delay(100);
  }*/
}


2014年12月22日 星期一

Week15

期末作品進度
#arduino
void setup(){
  Serial.begin(9600);
  pinMode(2, INPUT_PULLUP);
  //pinMode(4, INPUT_PULLUP);
  //pinMode(12, OUTPUT);
  pinMode(13, OUTPUT);
}

void loop(){
  int sensorVal = digitalRead(2);
  //int sensorVal2 = digitalRead(4);

  if (sensorVal == HIGH) {
    digitalWrite(13, LOW);
  }
  else {
    digitalWrite(13, HIGH);
    Serial.write(100);
    delay(100);
  }
 
  /*if (sensorVal2 == HIGH) {
    digitalWrite(12, LOW);
  }
  else {
    digitalWrite(12, HIGH);
    Serial.write(65);
    delay(100);
  }*/
}



2014年12月15日 星期一

Week14

旋鈕

void setup()
{
  pinMode(13,OUTPUT);
}
void loop()
{
  int value = analogRead(A0);
  digitalWrite(13,HIGH);
  delay(value);
  digitalWrite(13,LOW);
  delay(value);
}

旋鈕&processing


2014年12月8日 星期一

Week13

我做什麼arduino就做什麼


void setup()
{
  Serial.begin(9600);
}

void loop()
{
  while(Serial.available()>0)
  {
    char data=Serial.read();
    Serial.print(data);
  }
}

按鈕案一下變I Love You

void setup()
{
  Serial.begin(9600);
  pinMode(2,INPUT_PULLUP);
}

void loop()
{
  while(Serial.available()>0)
  {
    char data=Serial.read();
    Serial.print(data);
  }
  if(digitalRead(2)==LOW)
    Serial.println("I Love You");
   else
     Serial.println("I Don't Love You");
}

2014年12月1日 星期一

Week12

接按鈕

void setup(){  pinMode(13,OUTPUT);  pinMode(2,INPUT);}void loop(){  if(digitalRead(2)==HIGH)  {    digitalWrite(13,HIGH);    tone(8,440,300);  }  else  {    digitalWrite(13,LOW);    noTone(8);  }}#2#include "pitches.h"const int buttonPin = 2;     // the number of the pushbutton pinconst int ledPin =  13;      // the number of the LED pin
// variables will change:int buttonState = 0;         // variable for reading the pushbutton status
// notes in the melody:int melody[] = {  NOTE_C4, NOTE_G3,NOTE_G3, NOTE_A3, NOTE_G3,0, NOTE_B3, NOTE_C4};
// note durations: 4 = quarter note, 8 = eighth note, etc.:int noteDurations[] = {  4, 8, 8, 4,4,4,4,4 };
void setup() {  // initialize the LED pin as an output:  pinMode(ledPin, OUTPUT);        // initialize the pushbutton pin as an input:  pinMode(buttonPin, INPUT);}
void loop() {  // read the state of the pushbutton value:  buttonState = digitalRead(buttonPin);
  // check if the pushbutton is pressed.  // if it is, the buttonState is HIGH:  if (buttonState == HIGH) {         // turn LED on:        digitalWrite(ledPin, HIGH);  // iterate over the notes of the melody:  for (int thisNote = 0; thisNote < 8; thisNote++) {
    // to calculate the note duration, take one second     // divided by the note type.    //e.g. quarter note = 1000 / 4, eighth note = 1000/8, etc.    int noteDuration = 1000/noteDurations[thisNote];    tone(8, melody[thisNote],noteDuration);
    // to distinguish the notes, set a minimum time between them.    // the note's duration + 30% seems to work well:    int pauseBetweenNotes = noteDuration * 1.30;    delay(pauseBetweenNotes);    // stop the tone playing:    noTone(8);  }    }   else {    // turn LED off:    digitalWrite(ledPin, LOW);    noTone(8);   }}
接蜂鳴器




2014年11月24日 星期一

week11

arduino霹靂燈實作組員:
   01160723邱詠縉
   01160741王奕勝


void setup() {               
  pinMode(13, OUTPUT);
  pinMode(12, OUTPUT);
  pinMode(11, OUTPUT);
  pinMode(10, OUTPUT); 
}
void loop() {
  digitalWrite(13, HIGH);  
  delay(100);
  digitalWrite(13, LOW); 
  delay(100);           
  digitalWrite(12, HIGH);  
  delay(100);           
  digitalWrite(12, LOW);   
  delay(100);
  digitalWrite(11, HIGH);  
  delay(100);           
  digitalWrite(11, LOW);   
  delay(100);
  digitalWrite(10, HIGH);  
  delay(100);           
  digitalWrite(10, LOW);   
  delay(100);
  digitalWrite(11, HIGH);  
  delay(100);           
  digitalWrite(11, LOW);   
  delay(100);
  digitalWrite(12, HIGH);  
  delay(100);           
  digitalWrite(12, LOW);   
  delay(100);
}

第10週業界雙師授課心得報告-愛迪斯胡啟彥先生

第8週業界雙師授課心得報告-叁式曾煒傑先生

從很早之前就聽老師說過曾煒傑開的叁式的這家公司,是做很多關於互動技術的產品,配合各種大大小小的合作案,創造出最獨特最有創意的作品,在課堂上有放很多合作過的影片給我們看,真的很享受在影片的情境。
七感官的影片,現代舞者配上投影下光線的變化,投影出了舞者的內心世界,不僅更強調了舞者想表達的意境,每一個波動更深深牽動著台下觀眾的情緒,高潮迭起,讓人目不暇給。
乾隆潮,各個朝代的服裝,還會有不同國家的人們跟客人打招呼,這是很貼心的舉動,讓人更體會這個展覽的細心,利用投影的技術把展示品投影出來,加入更多互動的技術,讓展覽不會在死板的觀看產品的介紹牌,能更生動的吸引大人小孩的目光,進而達到吸取知識的效果,相信去體驗過的人一定會覺得值回票價,一種大豐收的感覺。
白蘭氏雞精,關於跟夢想結合的這個創意,我覺得貼心,人因為有夢想,才會不斷地前進,讓人們看見夢想,想像自己成功的樣子,不僅能更有動力,也會感到無比的能量再推著自己,看完連自己都想去體驗一下我自己的夢想了。
最讓我印象深刻的是OK GO的「 I Won't Let You Down」一鏡到底MV,真,要花多久時間才可以拍出這麼細膩無失誤的MV,只能說做的非常的精緻又不失打廣告的效果,互動科技真的是個非常非常強大的技術。


很感謝叁式讓我們看見很多事物原來不是夢,可以由我們來完成!!!

2014年10月27日 星期一

期中作品

組員: 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();
  }
}

2014年10月13日 星期一

01160723_邱詠縉 期中作品

遊戲名稱:Thief
這是一款訓練反應的小遊戲
要精準的一次或兩次跳躍才能獲得高分
雖然簡單卻很有趣
所以想試著寫看看
http://www.youtube.com/watch?v=49sfLMgTQQ4

2014年10月6日 星期一


void setup(){
  size(600,400);
}

void draw(){
  drawFlower();
}

void drawFlower(){
  translate(mouseX,mouseY);
  fill(#FF6464); ellipse(0,0,40,90);
  rotate(PI/6);
 fill(#FF6464); ellipse(0,0,40,90);
  rotate(PI/6);
  fill(#FF6464); ellipse(0,0,40,90);
  rotate(PI/6);
fill(#FF6464); ellipse(0,0,40,90);
  rotate(PI/6);
  fill(#FF6464); ellipse(0,0,40,90);
  rotate(PI/6);
  fill(#FF6464); ellipse(0,0,40,90);
  fill(#FF7C17); ellipse(0,0,40,40);
}

void setup() {
  size(600, 400);
}

void draw() {
  drawFlower();
}

void drawFlower() {
  translate(mouseX, mouseY);
  rotate(0.05*frameCount);
  for(int i=0;i<9;i++){
  fill(#FF1414);   ellipse(0, 0, 40, 90);
  rotate(PI/6);
  }
  
  fill(#FF7C17);   ellipse(0, 0, 40, 40);
}

隨滑鼠位置變顏色

void setup() {
  size(600, 400);
}

void draw() {
  drawFlower();
  colorMode(HSB,600,400,400);
}

void drawFlower() {
  fill(mouseX,mouseY,400);
  translate(mouseX, mouseY);
  rotate(0.05*frameCount);
  for(int i=0;i<9;i++){
  //fill(#FF1414);  
  ellipse(0, 0, 40, 90);
  rotate(PI/6);
  }
 
  fill(#FF7C17);
  ellipse(0, 0, 40, 40);
}

2014年9月29日 星期一

PImage img, imgbg; float eggX=750, eggY=550, eggVX, eggVY, flying=0; void setup() { size(800, 600); img = loadImage("dog.png"); imgbg = loadImage("background.jpg"); imgbg.resize(800, 600); imageMode(CENTER); } void draw() { background(imgbg); image(img, mouseX, mouseY, 200, 200); if (flying>0) { ellipse(eggX, eggY, 50, 50); eggX += eggVX; eggY += eggVY; flying--; } } void mousePressed() { eggX=750; eggY=550; flying=30; eggVX=(mouseX-eggX)/30; eggVY=(mouseY-eggY)/30; }

2014年9月22日 星期一



小畫家
void setup(){
size(800,600);
background(0);
fill(255,0,0); rect(0,0,100,100);
fill(0,255,0); rect(0,100,100,100);
fill(0,0,255); rect(0,200,100,100);
fill(255,255,255); rect(0,300,100,100);
rect(700,0,100,100); ellipse(750,50,5,5);
rect(700,100,100,100); ellipse(750,150,10,10);
rect(700,200,100,100); ellipse(750,250,15,15);

}
void draw(){

if(mousePressed && mouseX>100 && mouseX<700) line(mouseX,mouseY,pmouseX,pmouseY);

}
void mousePressed(){
if(mouseX<100 && mouseY <100) stroke(255,0,0);
else if(mouseX<100 && mouseY <200) stroke(0,255,0);
else if(mouseX<100 && mouseY <300) stroke(0,0,255);
else if(mouseX<100 && mouseY <400) stroke(255,255,255);
else if(mouseX>700 && mouseY <100) strokeWeight(5);
else if(mouseX>700 && mouseY <200) strokeWeight(10);
else if(mouseX>700 && mouseY <300) strokeWeight(15);
}
void mouseClicked()
{
 
}

2014年9月15日 星期一

size(600,400);
background(9,39,52);

fill(10,60,77);
rect(0,300,600,10);
fill(5,20,26);
rect(0,330,600,25);
fill(3,10,13);
rect(0,355,600,45);

fill(255,255,255);
ellipse(400,100,50,50);

stroke(255,0,0);
strokeWeight(4);
point(200,100);