// Rocket Tail ParticleSystem ps,ps1,ps2; ArrayList repellers; void setup() { size(400,540); ps = new ParticleSystem(1,new PVector(width/2,height/4)); ps1 = new ParticleSystem(1,new PVector(width/2+5,height/4)); ps2 = new ParticleSystem(1,new PVector(width/2-5,height/4)); // Create a list of Repeller objects repellers = new ArrayList(); for (int i = 0; i < 15; i++) { repellers.add(new Repeller(random(width),random(height/1.4,height/1.2))); } smooth(); } void draw() { background(40); // Apply gravity force to all Particles PVector gravity = new PVector(0,0.2); ps.applyForce(gravity); // Apply repeller objects to all Particles //ps.applyRepellers(repellers); // Run the Particle System ps.run(); // Add more particles ps.addParticle(); ps1.applyForce(gravity); // Apply repeller objects to all Particles // ps1.applyRepellers(repellers); // Run the Particle System ps1.run(); // Add more particles ps1.addParticle(); ps2.applyForce(gravity); // Apply repeller objects to all Particles // ps1.applyRepellers(repellers); // Run the Particle System ps2.run(); // Add more particles ps2.addParticle(); // Display all repellers for (int i = 0; i < repellers.size(); i++) { Repeller r = (Repeller) repellers.get(i); // r.display(); r.drag(); } } void mousePressed() { for (int i = 0; i < repellers.size(); i++) { Repeller r = (Repeller) repellers.get(i); r.clicked(mouseX,mouseY); } } void mouseReleased() { for (int i = 0; i < repellers.size(); i++) { Repeller r = (Repeller) repellers.get(i); r.stopDragging(); } }