I need to instantiate this so I can combine it with other sketches but keep getting an error. PLS HELP
const radius = 100;
let x, y;
//code for icons
p.setup = function(){
p.createCanvas(windowWidth, windowHeight);
x = p.random(windowWidth);
y = p.random(windowHeight);
p.textAlign(CENTER);
setInterval(timeIt, 1000)
};
p.draw = function(){
p.background(200);
p.fill(255, 0, 255);
p.noStroke();
p.ellipse(x,y, radius2, radius2);
p.fill (50, 10, 90);
p.text(" Score: " + score, 10, 20);
p.fill (10, 0, 80);
if (timerValue >= 10) {
p.text(ā0:ā + timerValue, width / 2, height / 2);
}
if (timerValue < 10) {
p.text(ā0:0ā + timerValue, width / 2, height / 2);
}
if (timerValue == 0) {
p.fill(200, 200, 200);
p.noStroke();
p.ellipse(x,y, radius2, radius2);
p.fill (50, 10, 90);
p.text('game over // ā + "your score was: " + score, width / 2, height / 2 + 15);
}
};
p.mousePressed = function(){
let d = p.dist(mouseX, mouseY, x, y);
if (d < radius){
x = p.random(windowWidth);
y = p.random(windowHeight);
score++;
}
else{
scoreā;
}
};
let score = 0;
p.timeIt = function() {
if (timerValue > 0) {
timerValueā;
}
};
};
let myp5 = new p5(sketch);
my error is : Called from line in āpromiseReactionJobā in [native code] ([native code]:undefined:undefined)