Hello,
with this code I would like there to be a counter every time I press a square, but if I put too long or if I press next to it the counter goes back to 0
and even if it is possible a score multiplier, imagine that one square is worth 1 point and if I press correctly on 17 square then the next one will be worth 17 point and so on until I am wrong or are too long sorry for my poor English
int wait = 1000, lastTime = 0, score = 0, size = 50; //temps, score et taille
PVector pos = new PVector(random(0,600-size),random(0,600-size));
void setup() {
fullScreen(); //plein ecran
}
void draw() {
background(0); //couleur du fond
square(pos.x,pos.y,size); //localisation carré
if(mousePressed && mouseX > pos.x && mouseX < pos.x + size && mouseY > pos.y && mouseY < pos.y + size) //si clique sur souris alors l'enlever
{
score++;
pos = new PVector(random(width-size),random(height-size)); //localisation aleatoire
lastTime = millis(); //timer
}
if(lastTime + wait < millis()) {pos = new PVector(random(width-size),random(height-size)); lastTime = millis(); } //si trop de temps a cliquer alors enlever le carré
}