Categories > Coding > Python >

Simple console clicker game

Posts: 662

Threads: 65

Joined: Oct, 2022

Reputation: 30

Posted

Hi, i am learning python so i decided to make this basic clicker game using the console. Its all open source. You do not need to give credit if using. It uses loops, variables and other basic stuff :)

 

import os

value = 0
multiplier = 1
userinput = input("Press any key to get more > ")

while True:
  if userinput != "":
    value += multiplier
    os.system("clear")
    print(value)
    userinput = input("Press any key to get more > ")
    if value >= 10:
      multiplier = 2
    elif value >= 20:
      multiplier = 4
    elif value >= 30:
      multiplier = 8
    elif value >= 100:
      multiplier = 100
    elif value >= 1000:
      multiplier = 1000 
  • 0

Try the cheat launcher verve today ⬇

https://i.imgur.com/QdS8sQ5.png

Join Neuron Discord Server - https://discord.gg/harAKHv32K

marcus__

S.K.I.D

vip

Posts: 444

Threads: 23

Joined: Nov, 2022

Reputation: 29

Replied

try using tkinter (gui) :)

tkinter is pretty good for simple stuff

example code for simple tkinter clicker:

 

from tkinter import *
from tkinter import messagebox
root = Tk()

root.counter = 0
root.increment = 1


def ckd():
    root.counter += root.increment
    L['text'] = 'Button clicked: ' + str(root.counter)


def ckd2():
    if root.counter >= 1:
      root.increment += 1
      root.counter -= 1
    else:
      messagebox.showwarning("Not enough clicks", "You currently have 0 clicks.")

b = Button(root, text="Click Me", command=ckd)
b.pack()

b = Button(root, text="+1 increment", command=ckd2)
b.pack()

L = Label(root, text="No clicks yet.")
L.pack()

root.mainloop()

what it shows:

https://media.discordapp.net/attachments/1058388446705627228/1064780641549422603/Screenshot_2023-01-17_133748.png

  • 1

!!!!!marcus__!!!!!#8611

https://cdn.discordapp.com/attachments/1066053366758780978/1078052772567597127/image.png

Posts: 47

Threads: 6

Joined: Jan, 2023

Reputation: 3

Replied

Flutter

Content length must be 10-5000 chars

 

  • 0

I bet you a dollar you saw this.

Posts: 662

Threads: 65

Joined: Oct, 2022

Reputation: 30

Replied

@marcus__

ty for the suggestion :)

  • 0

Try the cheat launcher verve today ⬇

https://i.imgur.com/QdS8sQ5.png

Join Neuron Discord Server - https://discord.gg/harAKHv32K

marcus__

S.K.I.D

vip

Posts: 444

Threads: 23

Joined: Nov, 2022

Reputation: 29

Replied

@Pluto_Guy

just now there was a bug where when you clicked on +1 increment the counter wouldn't update so

from tkinter import *
from tkinter import messagebox

root = Tk()

root.counter = 0
root.increment = 1


def ckd():
    root.counter += root.increment
    L['text'] = 'Button clicked: ' + str(root.counter)


def ckd2():
    if root.counter >= 1:
        root.increment += 1
        root.counter -= 1
        L['text'] = 'Button clicked: ' + str(root.counter)
    else:
        messagebox.showwarning("Not enough clicks", "You currently have 0 clicks.")


b = Button(root, text="Click Me", command=ckd)
b.pack()

b = Button(root, text="+1 increment", command=ckd2)
b.pack()

L = Label(root, text="No clicks yet.")
L.pack()

root.mainloop()

  • 0

!!!!!marcus__!!!!!#8611

https://cdn.discordapp.com/attachments/1066053366758780978/1078052772567597127/image.png

Users viewing this thread:

( Members: 0, Guests: 1, Total: 1 )