(This is a question related to a University Assignment!)

I am creating a Dandelion in processing for a Creative Programming Challenge.

Hi all, I have just started with processing and am experiencing some problems with the way objects are placed on top of each other, and in which ‘layers’ they appear. (if I compare it with adobe Photoshop layers for example).

I have created a circle ring around a object because i did not manage to make this object circular, it is still square. I have now cheated a bit, and placed a ring with a certain strokeweight over this to hide the square shape and make it look like a circle. After this, i want to add some Seeds, but after the counter i created reaches its max, the seeds keep dissapearing behind the Ring I created earlier.

I checked the order of functions that are being called, and placed the Seed function at the end of the draw, but it does not place the Seed objects on the top ‘layer’. anyone who how to fix this?

Thanks!

Here is my code;

```
ArrayList<Dotcore>dotcores;
int corewidth = 150;
int coreheight = 150;
int Xcore = 500;
int Ycore = 500;
int dotcounter = 20;
float seedsangle = 0.0;
int seedscounter = 100;
int counter = 0;
ArrayList<Seed>seeds;
void setup () {
background(255);
size(1000, 1000);
dotcores = new ArrayList<Dotcore>();
seeds = new ArrayList<Seed>();
}
void draw () {
// CORE DANDELION
fill(#EDF0D7);
ellipse(Xcore, Ycore, corewidth, coreheight);
// DOTS IN THE CORE
newDot();
for (Dotcore DT : dotcores) {
if (DT.edges()) {
DT.growing = false;
}
DT.show();
DT.grow();
}
// RING DANDELION
boolean ring = false;
if (counter < seedscounter) {
ring = true;
} else {
ring = false;
}
if (ring == true) {
stroke(56);
noFill();
strokeWeight(200);
ellipse(Xcore, Ycore, 90, 90);
}
if (ring == false) {
stroke(255);
noFill();
strokeWeight(200);
ellipse(Xcore, Ycore, 90, 90);
}
// STEM AND SEEDS
stem(500, 500);
counter = counter +1;
if (counter < seedscounter) {
seeds(500, 500, 65);
}
}
void newDot() {
pushMatrix();
translate(width/2, height/2);
float x = random(Xcore-corewidth/2, Xcore+coreheight/2);
float y = random (Ycore- coreheight/2, Ycore+coreheight/2 );
popMatrix();
boolean valid = true;
for (Dotcore DT : dotcores) {
float d = dist(x, y, DT.x, DT.y);
if (d<DT.r) {
valid = false;
break;
}
}
if (valid) {
dotcores.add(new Dotcore(x, y));
}
}
void stem(int x, int y) {
pushMatrix();
translate(x, y);
strokeWeight(20);
stroke(#C4C94F);
line(0, 0+60, 0, height);
popMatrix();
}
void seeds(int x, int y, int radius) {
seedsangle += random (-5, 5);
x += (cos(seedsangle)*radius);
y += (sin(seedsangle)*radius);
translate (x, y);
rotate(seedsangle);
fill(#B4A47A);
stroke(#98885F);
strokeWeight(1);
ellipse(0, 0, 20, 5);
}
void newSeed() {
}
```

this is the second tab

```
class Dotcore {
float x;
float y;
float r;
boolean growing = true;
Dotcore(float x_, float y_) {
x = x_;
y = y_;
r = 7;
}
void grow() {
if (growing) {
r = r +1;
}
}
boolean edges() {
return (x + r > Xcore + corewidth/2 || x - r < Xcore - corewidth/2 || y + r > Ycore + coreheight/2 || y - r < Ycore - coreheight/2 || r > 7 );
}
void show() {
stroke(#9CA25F);
strokeWeight(1);
fill(#E3E8B0);
ellipse(x, y, r*2, r*2);
}
}
```