// Attack of Alien Spaceships: ICM Project # 4: Yonatan Kelib // Created with the help of Tye a second year student. Ship [] ships; void setup(){ size(420,420); smooth(); ships = new Ship [15]; for (int i=0; i < ships.length; i++){ ships[i] = new Ship (color(random(121)),0, random(height),random(5),i*2); } } void draw(){ framerate(60); background(112,128,144); for (int i=0; i< ships.length; i++) { ships[i].render(); ships[i].crawl(); } } class Ship { color c; float x; float y; float speed; float w,h; Ship (color col, float x_, float y_, float sp, float thesize){ c=col; x=x_; y=y_; speed =sp; w=thesize; h=thesize/2; } void render(){ fill(250); ellipse(x,y,w,h); ellipse(x+20, y+20,w+40,h+40); ellipse(x+15, y+18,w+23,h+23); } void crawl(){ x=x+speed; if (x >width + w){ x=-w; } } }