class Squirtmanager { ArrayList squirts; Squirtmanager() { squirts = new ArrayList(); // Initialize the arraylist } void run() { if (pressMode==1) { if (eraseMode==1) { eraseSquirt(); } else { addSquirt(); } } for (int i = 0; i < squirts.size(); i++) {//working-adding to arraylist Squirt s = (Squirt) squirts.get(i); s.run(); //can add in two 'if clauses' here later- if erased, delete. or if colorchanged, erase particle and replace with one of different color. } } void addSquirt () { squirts.add(new Squirt()); } void eraseSquirt () { for (int i = squirts.size()-1; i >= 0; i--) { Squirt e = (Squirt) squirts.get(i); float squirtx= e.getcol(); int coldiff= int (abs(squirtx-mouseX)); int layerdist= int (abs(e.getlayer()-curlayer)); int rowdist= int (abs(e.getrow()-mouseY)) ; if ( (coldiff<=boxsize) && (layerdist<=boxsize) && (rowdist <=boxsize) ) { squirts.remove(i); } } } void sortbyrow() { } void sortbycolumn() { } } /*From MULTIPLE PARTICLE SYSTEMS: class ParticleSystem { ArrayList particles; // An arraylist for all the particles Vector3D origin; // An origin point for where particles are birthed ParticleSystem(int num, Vector3D v) { particles = new ArrayList(); // Initialize the arraylist origin = v.copy(); // Store the origin point // Add an initial group of particles to the ArrayList for (int i = 0; i < num; i++) { if (random(1) > 0.2) { particles.add(new Particle(origin)); } else { // There is a 20% chance we will add a "crazy particle" into the system particles.add(new CrazyParticle(origin)); } } } void run() { // Cycle through the ArrayList backwards b/c we are deleting for (int i = particles.size()-1; i >= 0; i--) { Particle p = (Particle) particles.get(i); p.run(); if (p.dead()) { particles.remove(i); } } } void addParticle() { particles.add(new Particle(origin)); } void addParticle(Particle p) { particles.add(p); } // A method to test if the particle system still has particles boolean dead() { if (particles.isEmpty()) { return true; } else { return false; } } } */