clicky
unknown
plain_text
2 years ago
1.3 kB
4
Indexable
import os import time # Game variables score = 0 upgrade_cost = 10 multiplier = 1 # Clear console screen def clear_screen(): os.system('cls' if os.name == 'nt' else 'clear') # Function to display the game status def display_status(): clear_screen() print("=== Clicker Game ===") print("Score: {}".format(score)) print("Multiplier: {}".format(multiplier)) print("Upgrade Cost: {}".format(upgrade_cost)) print("===================") # Function to process user input def process_input(): global score, multiplier, upgrade_cost choice = input("Press 'C' to click, 'B' to buy an upgrade, or 'Q' to quit: ").lower() if choice == 'c': score += multiplier elif choice == 'b': if score >= upgrade_cost: multiplier += 1 score -= upgrade_cost upgrade_cost *= 2 else: print("Insufficient score to buy upgrade!") time.sleep(1) # Pause for 1 second after buying an upgrade elif choice == 'q': return True else: print("Invalid choice!") return False # Main game loop def main(): game_over = False while not game_over: display_status() game_over = process_input() print("Thanks for playing!") # Run the game main()
Editor is loading...