คลิกที่ภาพ แล้ว กด Enter ให้โดนจุดสีแดงตรงกลางเป้า
processing code
processing code
int x = 0;
int y = 0;
int a = 520;
int i = 0;
int c = 6;
int r = 250;
int s = second();
int p = 5;
void setup (){
size (600,500);
}
void draw () {
background(29,50,13);
drawTarget (i,c,r);
drawPin ();
if (x<500) {
x=x+5;
}else {
if(y<-500){
x=0;
y=0;
}else{
y=y-5;
}
}
if (keyCode == ENTER) {
a=a-10;
}else{
a = 520;
}
if (x+y == 285 && a == 180 || x+y == -285 && a == 180){
println (p+" points");
}
}
void drawTarget (int i,int c,int r){
while(i<c){
fill (255);
stroke(234,9,9);
ellipse (x+y,150,r,r);
r=r-50;
i=i+1;
}
fill (255,0,0);
ellipse (x+y,150,5,5);
}
void drawPin () {
fill (0);
ellipse (300,a,20,20);
}
ไม่มีความคิดเห็น:
แสดงความคิดเห็น