2017年1月5日 星期四

week17 曉瑀上課筆記~

20170105 week17

今天認識很多材料

arduino













今日實作:processing+太鼓達人

step1:下載圖片


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;
}
}











step2: 設立分數及生命值

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(80); 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; } }



ps. 野外求生:電池加鋼刷可生火





沒有留言:

張貼留言