How could i make a clicker game where the power up button adds 1 to the score every minute. I already have a button that gives one point every time it is clicked. After you get 10 points, you can click the power up. I want it to give the player 1 point every 60 seconds.
I am currently having trouble with it working because it keeps crashing, i dont know if i need a better computer or just better code. When it runs, it will take away the tens points but do nothing after.
So i want it to Run, Main button be clicked to get points, power up button to be clikced, and then add one point every minute/60 seconds.
import turtle
import tkinter
from tkinter import *
import time
import datetime
from time import time, sleep
root = Tk()
global score
score = 0
scoreLabel = Label(root, text="Your Score:" + str(score))
scoreLabel.place(x=100, y=100)
def myClick():
global score
score += 1
scoreLabel.config( text="Your Score:" + str(score))
def subClick():
global score
if score >= 10:
score -= 10
while True:
sleep(10)
score += 1
scoreLabel.config( text="Your Score:" + str(score))
addButton = Button(root, text="Click Me", padx=250, pady=250, command=myClick)
addButton.pack()
powerupButton = Button(root, text="Power Up", padx=50, pady=10, command=subClick)
powerupButton.place(x=300, y=300)
powerupButton.pack()
root.mainloop()