Created
April 19, 2017 16:49
-
-
Save spheppner/c99580a60f27bdc04372c9bd61016442 to your computer and use it in GitHub Desktop.
A german game made with easygui (You need easygui in the same folder).
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
#! /usr/bin/python3 | |
import random | |
import easygui | |
m = easygui.choicebox("Die Türen", choices=["Einstellungen","spielen","Ende"]) | |
if m == "Ende": | |
easygui.msgbox("Tschüss!") | |
sys.exit() | |
#if m == "spielen": | |
# easygui.msgbox("Erfinde selbst ein Spiel") | |
s = "Normalo" | |
if m == "Einstellungen": | |
s=easygui.buttonbox("Wähle die Schwierigkeit!", choices=["Cheat","Baby","Normalo","Elite","Anführer","Herrscher"]) | |
# ---- spiel beginnt --- | |
hp = 50 | |
raeume = 1 | |
if s == "Cheat": | |
anzahl_tueren = 5 | |
hp = 100 | |
elif s == "Baby": | |
anzahl_tueren = 4 | |
hp = 90 | |
elif s == "Normalo": | |
anzahl_tueren = 3 | |
hp = 80 | |
elif s == "Elite": | |
anzahl_tueren = 3 | |
hp = 50 | |
elif s == "Anführer": | |
anzahl_tueren = 2 | |
hp = 20 | |
elif s == "Herrscher": | |
anzahl_tueren = 2 | |
hp = 15 | |
#anzahl_tueren = 3 | |
doors = ["dunkle Tür", "Holztüre", "Eisentor", "Diamantentür", "Helle Tür", "riesige Tür", "Leiter", "offene Tür", "Loch im Boden"] | |
while hp >0 and raeume < 100: | |
#easygui.msgbox("du bist im Raum {}".format(raeume) | |
random.shuffle(doors) | |
if random.random() < 0.01: | |
hp+= 10 | |
easygui.msgbox("Du findest ein Keks und stärkst dich!") | |
elif random.random() < 0.01: | |
hp -= 2 | |
easygui.msgbox("Du steigst in eine Falle und verlierst hitpoints!") | |
elif random.random() < 0.01: | |
hp -= 5 | |
easygui.msgbox("Eine Schlange beißt dich!") | |
elif random.random() < 0.01: | |
raeume += 2 | |
easygui.msgbox("Eine Fee zeigt dir den Weg bis zur Grenze ihres Reiches!") | |
elif random.random() < 0.01: | |
raeume -= 5 | |
easygui.msgbox("Ein Troll verjagt dich!") | |
door = easygui.buttonbox("Du bist im Raum {}\n Wähle die Tür".format(raeume), | |
"hp: {}".format(hp), | |
doors[:anzahl_tueren]) | |
if random.random() < 1/anzahl_tueren: | |
schaden=random.randint(0,6) | |
easygui.msgbox("Der Geist beißt nach dir, du verlierst {} hitpoints".format(schaden)) | |
hp -= schaden | |
else: | |
easygui.msgbox("Glück gehabt, der Geist war hinter einer anderen Tür!") | |
raeume += 1 | |
if hp < 1: | |
easygui.msgbox("Der Geist gewinnt immer!") | |
else: | |
easygui.msgbox("Bravo! Du hast gewonnen und 100 Räume lang überlebt!") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment