顯示具有 99160973_李欣隆 標籤的文章。 顯示所有文章
顯示具有 99160973_李欣隆 標籤的文章。 顯示所有文章

2015年1月19日 星期一

互動技術概論-期中作業補交

import ddf.minim.*;
AudioPlayer player;
AudioPlayer player1;
AudioPlayer player2;
Minim minim;//audio context
PImage img;
PImage img1;
PImage img2;
PImage img3;
PImage img4;
PImage img5;
PImage img6;
PImage win;
PImage lose;
PImage ready;
PImage GO;
int r1x=0;
int r2x=0;
float runnerx=80;
float runner2x=80;
float bgx=1500;
int checktype=-1;
int runtype=1;
int background=0;
int count=0;
int badrunner=0;
int readyt=0;
import processing.serial.*;
Serial myPort;
void setup() {
  myPort=new Serial(this,"COM1",9600);
  minim = new Minim(this);
  player = minim.loadFile("file.mp3", 2048);
  player1 = minim.loadFile("winner.wav", 2048);
  player2 = minim.loadFile("loser.WAV", 2048);
  img = loadImage("bg.jpg");
  img1 = loadImage("2.png");
  img2 = loadImage("1.png");
  img3 = loadImage("3.png");
  img4 = loadImage("5.png");
  img5 = loadImage("4.png");
  img6 = loadImage("6.png");
  win = loadImage("win.jpg");
  lose = loadImage("lose.jpg");
  ready = loadImage("ready.png");
  GO = loadImage("GO.png");
  imageMode(CENTER);
  size(800, 256);
}
int xx=0,zz=0;
void draw() {
 
  //-------------------------------
 
  if(myPort.available()>0)
{
int a=myPort.read();
if(a=='A') {xx=1;}
if(a=='B') {zz=1;}
}

  if (background==1)
    if (checktype!=-2)
      if (xx==1) {
        r1x+=20;
        checktype=0;
        runtype=2;
        if (bgx>=-700)bgx-=20;
        else runnerx+=20;
       
        xx=0;
      }
  if (background==1)
    if (checktype!=-3)
      if (zz==1) {
        r1x+=20;
        checktype=11;
        runtype=3;
        if (bgx>=-700)bgx-=20;
        else runnerx+=20;
        zz=0;
    }
  //-------------------------------
  if (background==0) {
    image(img, bgx, 128);
    image(img1, runnerx, 160);
    image(img5, runner2x, 210);
    count++;
    if (count<=70)image(ready, 400, 128, 394, 150);
    else image(GO, 400, 128, 394, 150);
    if (count==100)background=1;
  }


  if (background==1) {
    player.play();

    image(img, bgx, 128);

    if (runtype==1)image(img1, runnerx, 160);
    if (checktype==10) {
      runtype=1;
      checktype=-2;
    }
    if (checktype==20) {
      runtype=1;
      checktype=-3;
    }

    if (runtype==2&&checktype<=10&&checktype>=0) {
      image(img2, runnerx, 160);
      checktype++;
    }

    if (runtype==3&&checktype<=20&&checktype>=11) {
      image(img3, runnerx, 160);
      checktype++;
    }
    badrunner++;
    if ((badrunner%20)<=10&&(badrunner%20)>=0)image(img5, runner2x, 210);
    if ((badrunner%20)>=11&&(badrunner%20)<=19)image(img6, runner2x, 210);
    r2x+=5;
    runner2x=runnerx+(r2x-r1x);

    if (runnerx>=500||r2x>=2630)background=2;
  }
  if (background==2)
  {
    if (r2x<2630)
    {
      player1.play();
      image(win, 400, 128);
    } else  if (r2x>=2630)
    {
      player2.play();
      image(lose, 400, 128);
    }
  }
}

void keyPressed() {
  if (background==1)
    if (checktype!=-2)
      if (key=='a') {
        r1x+=20;
        checktype=0;
        runtype=2;
        if (bgx>=-700)bgx-=20;
        else runnerx+=20;
      }
  if (background==1)
    if (checktype!=-3)
      if (key=='s') {
        r1x+=20;
        checktype=11;
        runtype=3;
        if (bgx>=-700)bgx-=20;
        else runnerx+=20;
      }
}

2015年1月18日 星期日

互動技術概論_期末作業

import ddf.minim.*;
AudioPlayer player;
AudioPlayer player1;
AudioPlayer player2;
Minim minim;//audio context
PImage img;
PImage img1;
PImage img2;
PImage img3;
PImage img4;
PImage img5;
PImage img6;
PImage win;
PImage lose;
PImage ready;
PImage GO;
int r1x=0;
int r2x=0;
float runnerx=80;
float runner2x=80;
float bgx=1500;
int checktype=-1;
int runtype=1;
int background=0;
int count=0;
int badrunner=0;
int readyt=0;
import processing.serial.*;
Serial myPort;
void setup() {
  myPort=new Serial(this,"COM3",9600);
  minim = new Minim(this);
  player = minim.loadFile("file.mp3", 2048);
  player1 = minim.loadFile("winner.wav", 2048);
  player2 = minim.loadFile("loser.WAV", 2048);
  img = loadImage("bg.jpg");
  img1 = loadImage("2.png");
  img2 = loadImage("1.png");
  img3 = loadImage("3.png");
  img4 = loadImage("5.png");
  img5 = loadImage("4.png");
  img6 = loadImage("6.png");
  win = loadImage("win.jpg");
  lose = loadImage("lose.jpg");
  ready = loadImage("ready.png");
  GO = loadImage("GO.png");
  imageMode(CENTER);
  size(800, 256);
}
int xx=0,zz=0;
void draw() {
 
  //-------------------------------
 
  if(myPort.available()>0)
{
int a=myPort.read();
if(a=='A') {xx=1;}
if(a=='B') {zz=1;}
}

  if (background==1)
    if (checktype!=-2)
      if (xx==1) {
        r1x+=20;
        checktype=0;
        runtype=2;
        if (bgx>=-700)bgx-=20;
        else runnerx+=20;
       
        xx=0;
      }
  if (background==1)
    if (checktype!=-3)
      if (zz==1) {
        r1x+=20;
        checktype=11;
        runtype=3;
        if (bgx>=-700)bgx-=20;
        else runnerx+=20;
        zz=0;
    }
  //-------------------------------
  if (background==0) {
    image(img, bgx, 128);
    image(img1, runnerx, 160);
    image(img5, runner2x, 210);
    count++;
    if (count<=70)image(ready, 400, 128, 394, 150);
    else image(GO, 400, 128, 394, 150);
    if (count==100)background=1;
  }


  if (background==1) {
    player.play();

    image(img, bgx, 128);

    if (runtype==1)image(img1, runnerx, 160);
    if (checktype==10) {
      runtype=1;
      checktype=-2;
    }
    if (checktype==20) {
      runtype=1;
      checktype=-3;
    }

    if (runtype==2&&checktype<=10&&checktype>=0) {
      image(img2, runnerx, 160);
      checktype++;
    }

    if (runtype==3&&checktype<=20&&checktype>=11) {
      image(img3, runnerx, 160);
      checktype++;
    }
    badrunner++;
    if ((badrunner%20)<=10&&(badrunner%20)>=0)image(img5, runner2x, 210);
    if ((badrunner%20)>=11&&(badrunner%20)<=19)image(img6, runner2x, 210);
    r2x+=5;
    runner2x=runnerx+(r2x-r1x);

    if (runnerx>=500||r2x>=2630)background=2;
  }
  if (background==2)
  {
    if (r2x<2630)
    {
      player1.play();
      image(win, 400, 128);
    } else  if (r2x>=2630)
    {
      player2.play();
      image(lose, 400, 128);
    }
  }
}

2014年11月24日 星期一

業界導師第八周心得

今天一樣請到了業界導師,來幫我們上三節課,老師今天介紹了他們團隊的作品,非常的專業.用許多UNITY和其他技術的結合,虛擬家居系統,不僅可以讓想要買家具.還可以設計自己喜歡的風格,在很多展場上都可以看到老師的作品,UNITY+ARDUINO所開發的,謝謝老師用心的教學

week11



業界老師心得分享

這次業界導師來上課,非常的用心,且教學內容生動有趣,且撥放喜多特別的影片抓住同學們的注意力,很多廣告看到才知道這麼厲害,有Nike公司做的面板,是要模仿球星動作,模仿照片還能上傳到facebook,三節課下來收穫很多.謝謝業界老師