class Cloud extends Entity{ float turnSpeed = 0.01; float pulseSpeed; int shade; //------------- Cloud(int shade){ super((int)random(width), (int)random(height)); vx = vy = 0; this.shade = shade; pulseSpeed = random(0.005,0.02); } //------------- void visualize(){ noStroke(); fill(shade,8); float r = 200 + 30*cos(age*pulseSpeed); ellipse(x,y,r,r); } } //################################## //################################## class Spore extends Entity{ float turnSpeed = 0.01; float pulseSpeed; float defaultSpeed = 0.2; int shade; //------------- Spore(int shade){ super((int)random(width), (int)random(height)); this.shade = shade; pulseSpeed = random(0.005,0.02); isPushable = true; } //------------- void update(){ if( mag(vx,vy) > defaultSpeed ){ vx -= vx*friction*gameSpeed; vy -= vy*friction*gameSpeed; } super.update(); } //------------- void visualize(){ pushMatrix(); translate(x,y); rotate( age*turnSpeed ); stroke(shade,64); for(float a=0; amaxAge) kill(); } //------------- void visualize(){ strokeWeight(5); stroke(255,255*(maxAge-age)/maxAge); fill(255,128*(maxAge-age)/maxAge); float r = 2*radius*age/maxAge; ellipse(x,y,r,r); strokeWeight(1); } } //################################## //################################## class Food extends Entity{ float turnSpeed = 0.01; //------------- Food(int ix, int iy){ super(ix,iy); isEatable = true; isPushable = true; foodCount++; } //------------- void update(){ vx -= vx*friction*gameSpeed; vy -= vy*friction*gameSpeed; super.update(); } //------------- void kill(){ foodCount--; super.kill(); } //------------- void visualize(){ pushMatrix(); translate(x,y); rotate( age*turnSpeed ); stroke(64,128); fill(255,128); beginShape(); for(float a=0; a