>>>>太鼓達人 遊戲製作>>>>
*準備器材:
(1)Arduino
(2)USB線(接Arduino)
(3)Arduino NANO
arduino mega vs uno
uno較便宜,也較適合初學者
(4)擴充板
(5)單芯線
(6)剪線鉗
(7)麵包板
*OmniKinect hands free motion control system(成果影片)
https://www.youtube.com/watch?v=Vs9bfxg6o8g
(8)三用電表
(9)電子工具包
(11)電烙鐵
焊錯的可以弄掉重新焊
(12)熱熔槍
*步驟:
(1)到Arduino官網下載
(2)電腦接上Arduino
(3)開啟Arduino程式編輯
*Processing 製作太鼓達人
PImage imgBG;
void setup() {
size(760, 430);
imgBG=loadImage("taiku.png");
}
int cx=700, cy=160;
void draw() {
background(imgBG);
fill(255);
rect(195, 102, 760-195, 229-102);
fill(251, 69, 43);
ellipse(cx, cy, 60, 60);
cx -= 3;
if (cx < 258) {
cx=800;
}
}
增加計分功能(利用滑鼠點擊)
PImage imgBG;
void setup() {
size(760, 430);
imgBG=loadImage("taiku.png");
}
int cx=700, cy=160;
int score =0,heart=10;
void draw() {
background(imgBG);
fill(0,0,255);
textSize(70);text("Score:"+ score + " Heart:" +heart,100,100);
fill(255); rect(195, 102, 760-195, 229-102);
fill(251, 69, 43); ellipse(cx, cy, 60, 60);
cx -= 3;
if (258 < cx && cx < 263 && mousePressed) {
score +=100;
cx=800;
}
if(cx < 250){
heart--;
cx=800;
}
}
沒有留言:
張貼留言