xxxxxxxxxx
24
let restartButton
function setup() {
createCanvas(400, 400);
// Initialize button
restartButton = new Button(width / 2, height/2)
restartButton.setImage("btn_start.png")
restartButton.addListener(restartTimer)
}
function draw() {
background(220);
// Draw button
restartButton.draw()
}
function restartTimer() {
print("Button Clicked");
//restartButton.disable() // Disable the button immediately after restarting
}