I'm trying to make the lines around the circle in void explosion
to appear when tailY == upHeight
. I don't know where to place explosion. Can someone help me with this please? The rocket needs to explode when it reaches certain height.
void draw() {
background(0);
drawRocket();
if (tailY == upHeight) {
explosion();
}
}
void explosion() {
noFill();
noStroke();
circle(tailX, tailY, circleSize);
for (int i = 0; i < a; i++) {
float angle;
if (a*i==0)
angle = radians(360.0);
else
angle = radians(360.0/a*i);
float x1 = tailX + circleSize/2 * cos(angle);
float y1 = tailY + circleSize/2 * sin(angle);
float x2 = tailX + (circleSize+10) * cos(angle);
float y2 = tailY + (circleSize+10) * sin(angle);
stroke(red, green, blue);
line(x1, y1, x2, y2);
}
}