int i_num = 40; float f_r =0; Unit[] ar_unit = new Unit[i_num]; void setup(){ size(640,360); background(255); for(int i=0; i1){ float n = atan2(ny+ry*0.05 - ax*50,nx+rx*0.05 - ay*50); //float n = atan2(nx, ny); f_rot = f_rot + (n-f_rot)*0.1; } f_vx = cos(f_rot); f_vy = sin(f_rot); } void update(){ f_x += f_vx* f_v; f_y += f_vy*f_v; if (f_x>200){ f_x = -200; } if (f_y>200){ f_y = -200; } if (f_x<-200){ f_x = 200; } if (f_y<-200){ f_y = 200; } push(); translate(f_x, f_y,0); noFill(); ellipseMode(CENTER_DIAMETER); stroke(255,150,150); ellipse(0, 0, f_okD, f_okD); stroke(150,150,255); ellipse(0, 0,f_ngD,f_ngD); stroke(0); line(0,0,f_vx*10, f_vy*10); translate(0,0,32); rotate(-atan2(f_vx,f_vy)); stroke(0,0,0,80); fill(200,200,200); box(2,4,64); pop(); } void setGroupArray(Unit[] u){ ar_unit = u; } }