有没有大佬帮我看一下我写的为什么不对
processing吧
全部回复
仅看楼主
level 1
508🌼甜甜 楼主
void setup(){
size(480, 480);
}
void draw(){
background(0);
noStroke();
for (int y = 0; y <= height; y += 40) {
for (int x = 0; x <= width; x += 40) {
fill(255, 140);
ellipse(x, y, 40, 40);
}
float d=dist(mouseX,mouseY,x,y);
if(d<20){
fill(255,0,0);
ellipse(mouseX,mouseY,40,40);
}
}
}
‘’
老师想要做鼠标经过的原变红色
怎么计算鼠标和园的距离啊
这个圆有那么多
2020年06月15日 03点06分 1
level 6
void draw(){
background(0);
noStroke();
for (int y = 0; y <= height; y += 40) {
for (int x = 0; x <= width; x += 40) {
fill(255, 140);
ellipse(x, y, 40, 40);
}
}
int i = (mouseX+20) / 40;
int j = (mouseY+20) / 40;
fill(255,0,0);
ellipse(i*40, j*40, 40, 40);
}
2020年06月16日 02点06分 2
1