i need to make a target that includes ellipses, triangles, rectangles and lines. so im trying to make a robot but im struggling on drawing the triangles and lines. i was thinking to have two triangles for ears directly above the eyes on top of the rectangle and have two lines on the bottom directly under the eyes starting at the bottom of the rectangle.
Also how do i make it disappear when a new one shows up so theres only one on at one time and so they only spawn within the yellow area and why is the yellow intruding into the white area is it because of rect mode in the target?
int xTarget;
int yTarget;
int randomTime;
int counter;
PFont f;
void setup() {
size (700, 800);
background(255);
frameRate(30);
f = createFont("Arial",16,true);
}
void draw() {
fill(240, 239, 94);
strokeWeight(0);
rect(0, 160, width, height);
fill(0);
strokeWeight(0);
textFont(f);
textSize(20);
text("Score: 0, Lives left: 3", 260, 80);
if(counter>randomTime)
{
randomTime=int(random(60,150));
xTarget=int(random(0,width));
randomTime=int(random(60,150));
yTarget=int(random(0,height));
counter=0;
}
counter++;
drawTarget();
}
void drawTarget() {
noStroke();
rectMode(CENTER);
fill(0, 0, 255);
rect(xTarget - 100, yTarget, 125, 75);
fill(255, 105, 180);
ellipse(xTarget - 135, yTarget-10, 25, 25);
fill(0, 255, 0);
ellipse(xTarget - 65, yTarget-10, 25, 25);
fill(255, 0, 0);
rect(xTarget - 100, yTarget+25, 50, 15);
fill(0, 255, 55);
triangle(xTarget, yTarget, xTarget-75, yTarget, xTarget-60, yTarget -60);
strokeWeight(2);
fill(0);
line(xTarget, yTarget, xTarget-50, yTarget-50);
}