how to make a clicker game in python

Solutions on MaxInterview for how to make a clicker game in python by the best coders in the world

showing results for - "how to make a clicker game in python"
Uriah
12 Jun 2020
1from tkinter import *
2import time
3
4master = Tk()
5
6def uiPrint():
7    info()
8    print("")
9    print(click)
10    blankLine()
11
12def info():
13    print("Double click purchases need 50 clicks!")
14    print("Auto clicker purchases need 75 clicks!")
15
16info()
17
18click = 0
19mult = 1
20dcp1 = 0
21
22def blankLine():
23    for i in range(20):
24        print("")
25
26def purchaseDoubleClicksCommand():
27    global click
28    global mult
29    if click < 5:
30        print("Not enough clicks!")
31        blankLine()
32    elif click >= 5:
33        mult = mult*2
34        click = click - 5
35        print("Double Clicks Purchased!")
36        blankLine()
37
38
39def purchaseAutoClickerCommand():
40    global click
41    if click < 7:
42        print("Not enough clicks!")
43        blankLine()
44    elif click >= 7:
45        click = click - 7
46        print("Auto clicker purchased!")
47        while True:
48            click = click + 1
49            time.sleep(1)
50
51
52def buttonCommand():
53    global click
54    global mult
55    click += 1*(mult)
56    uiPrint()
57
58    if click == 100:
59        print('''Achievement Unlocked: Junior Clicker!
60        BONUS 100 clicks!''')
61        click += 100
62
63    elif click == 400:
64        print ('''Achievement Unlocked: Little Ninja Clicks!
65        BONUS 200!''')
66        click += 300
67
68    elif click == 1500:
69        print ('''Achievement Unlocked: Click Ninja Master!
70        QUAD CLICKS!''')
71        mult = mult * 4
72
73    elif click == 3000:
74        print ('''Achievement Unlocked:  Jackie Chan Style!
75        8 TIMES THE CLICKS!''')
76        mult = mult * 8
77
78mainClickButton = Button(master, text="Click!", command = buttonCommand)
79mainClickButton.pack()
80
81purchaseDoubleClickButton = Button(master, text="Purchase Double Clicks", command = purchaseDoubleClicksCommand)
82purchaseDoubleClickButton.pack()
83
84purchaseAutoClickerButton = Button(master, text="Purchase Auto Clicker", command = purchaseAutoClickerCommand)
85purchaseAutoClickerButton.pack()
86
87master.title("Clicker! v0.0.6")
88master.geometry("%sx%s+%s+%s" % (200,70,512,512))
89mainloop()