Created
August 30, 2016 01:10
-
-
Save kjanjua26/06b71caad8e2ab38be9181cf713b3bef to your computer and use it in GitHub Desktop.
A simple game which takes a random number from the random module and adds it to the health of the player and if the difficulty level is increased the lesser the health player gets.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
import tkinter | |
from tkinter import messagebox | |
health = 50 | |
difficulty = input("Please input difficulty level: ") | |
difficulty = int(difficulty) | |
health_potion = random.randint(25, 50) | |
health = health + health_potion | |
health = int(health / difficulty) | |
def game(): | |
messagebox.showinfo("The Answer is: ", health) | |
gui = tkinter.Tk() | |
gui.title('My Game') | |
Label = tkinter.Label(gui, text='This is the game') | |
Label.pack() | |
button1 = tkinter.Button(gui, text='Press to get the potion health', command=game) | |
button1.pack() | |
gui.mainloop() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment