2.實作:太鼓達人
下載Arduino https://www.arduino.cc/en/Main/Donate
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;
}
}
沒有留言:
張貼留言