class Chrysanthemum { ArrayList a; float j = 0; int branchCounter = 0; Chrysanthemum(Vector3D loaction, Vector3D velocity, float chrysanthemumSize) { a = new ArrayList(); ChryBranch b = new ChryBranch(loaction,velocity,chrysanthemumSize); a.add(b); } void go() { for (int i = a.size()-1; i >= 0; i--) { ChryBranch b = (ChryBranch) a.get(i); b.update(); b.render(random(1,5)-j); j= j+0.00055; if (b.timeToBranch()) { branchCounter = branchCounter +1; if (0< branchCounter && branchCounter< 31 ){ createChryLeaves(b.loc); } if (31< branchCounter && branchCounter< 63 ){ createChryFlower(b.loc); } if (a.size() < 63) { a.add(b.chryBranch(random(30,50))); a.add(b.chryBranch(random(-20,-50))); } } } } void createChryLeaves ( Vector3D loc ) { ChryLeaves new_chryLeaves = new ChryLeaves(loc); chryLeaves.add(new_chryLeaves); } void createChryFlower ( Vector3D loc ) { ChryFlower new_chryFlower = new ChryFlower(loc); chryFlower.add(new_chryFlower); } }