Help with a game with target practice
in
Programming Questions
•
1 year ago
What I'm trying to do is when I click on the circle, it would move to another position and you would get a point. I'm pretty sure I could be able to implement the scoring system, but I don't know how to make sure the circle is clicked, since after it is clicked, it moves somewhere randomly. Help please.
int timer;
int target;
void setup()
{
target = 0;
size(470,470);
smooth();
noCursor();
}
void draw()
{
background(255);
fill(100);
drawTarget(mouseX, mouseY);
target();
timer = timer + 1;
text("Timer:"+ timer/40,400,40);
}
//image(target,50,50);
void target()
{
ellipse(50,50,50,50);
if(mousePressed)
{
target = 1;
}
if(target == 1)
{
ellipse(random(200),random(200),50,50);
}
}
//crosshairs
void drawTarget(int x, int y)
{
int radius = 30;
noFill();
stroke(0);
ellipseMode(CENTER);
ellipse(x, y, radius*2, radius*2);
line(x-radius-10,y, x+radius+10, y);
line(x,y-radius-10, x, y+radius+10);
}
int timer;
int target;
void setup()
{
target = 0;
size(470,470);
smooth();
noCursor();
}
void draw()
{
background(255);
fill(100);
drawTarget(mouseX, mouseY);
target();
timer = timer + 1;
text("Timer:"+ timer/40,400,40);
}
//image(target,50,50);
void target()
{
ellipse(50,50,50,50);
if(mousePressed)
{
target = 1;
}
if(target == 1)
{
ellipse(random(200),random(200),50,50);
}
}
//crosshairs
void drawTarget(int x, int y)
{
int radius = 30;
noFill();
stroke(0);
ellipseMode(CENTER);
ellipse(x, y, radius*2, radius*2);
line(x-radius-10,y, x+radius+10, y);
line(x,y-radius-10, x, y+radius+10);
}
1