Update game.py
stairs(< and >), cheats(fligh up and fligh down), doors(d) and keys(k), Boss fight, Special door(s), Special key(Boss key), teleporter(*), please help me to draw good dungeons
This commit is contained in:
parent
04934958a2
commit
3067ab1fd3
128
game.py
128
game.py
|
@ -2,27 +2,28 @@
|
|||
import random
|
||||
eg=("Mmh...","Mhh...","Schmatz...","Mampf...")
|
||||
lg=("Lecker!","Das war aber gut!")
|
||||
kg=("Du Opfer!","Du Lappen","Du Lauch","Hahaha du schwächling","Du bit richtig sclecht!","Du Hundesohn")
|
||||
#dungeon="..w..K.w.G...K.w.G..K..w..K..G.w.K.$..K.w.G.K.w.w.K.w.G.K.€.K.G.w.K..wKG.K.G.K.€.G.K.G.K.w.G.K.G.K..€.G.K.G.K.w..K.G.w.K.w.$.w.K.w.G.K.p"
|
||||
dungeon1="""
|
||||
############################################################################################################################
|
||||
#.<################################################################################################.#######.################
|
||||
#G<################################################################################################.#######.################
|
||||
##.#########################################################################################################################
|
||||
##.#########################################################################################################################
|
||||
##.###...........................................................................................................###########
|
||||
##.###.###############.#########################################################################################.###########
|
||||
##.###.....###########......#####..#############################################################################.###########
|
||||
##.#######..##########.####......##..###########################################################################.###########
|
||||
##.#####...###########.#########################################################################################.###########
|
||||
##.#####.#############.#########################################################################################.###########
|
||||
##.###.............*..........................*......G.....K.....................................................###########
|
||||
##K###.###############.#########################################################################################.###########
|
||||
##G###..K..###########*.....#####..#############################################################################.###########
|
||||
##.#######..##########*####......##..###########################################################################.###########
|
||||
##.#####...###########K#########################################################################################.###########
|
||||
##.#####.#############K#########################################################################################k###########
|
||||
##.#d#d#d#d#d#d#d#d#d#d#d#d#d#d#d#d#d#d#d#d#d#d#d#d#d#d#d#d#d#d#d#d#d#d#d#d#d#d#d#d#d#d#d#d#d#d#d#d#d#d#########.###########
|
||||
#......k.....#.........#.........#.........#...........#.........#.........#...........#.....#...#....B#########.###########
|
||||
#->....k.*...#......*..#......*..#........*#..........*#.......*.#.......*.#.........*.#....*#..*#...<B#########*###########
|
||||
####d#d#s#d#d#d#d#d#d#d#d#d#d#d#d#d#d#d#d#d#d#d#d#d#d#d#d#d#d#d#d#d#d#d#d#d#d#d#d#d#d#d#d#d#d#d#d#d#d#d#########.###########
|
||||
########p#####k#.#.#.#.#########################################################################################.###########
|
||||
################.#.#.#.#########################################################################################.###########
|
||||
################.#.#.#.#########################################################################################.###########
|
||||
################.#.#.#.############################################################################.#######.####.###########
|
||||
################.#.#.#.#########################################################################################.###########
|
||||
################.................................................................................................###########
|
||||
########p#####k#*#*#K#K#########################################################################################.###########
|
||||
################K#K#K#K#########################################################################################.###########
|
||||
################*#K#K#K#########################################################################################.###########
|
||||
################*#G#K#K############################################################################.#######.####.###########
|
||||
################.#*#G#K#########################################################################################.###########
|
||||
################.........*......*........*.....................G.......K.........................................###########
|
||||
############################################################################################################################
|
||||
############################################################################################################################
|
||||
############################################################################################################################
|
||||
|
@ -49,7 +50,7 @@ dungeon2="""
|
|||
#......................................................................................................#...........#.......#
|
||||
#......................................................................................................#...........#.......#
|
||||
#......................................................................................................#...........#.......#
|
||||
#...................................................................................................#######.....#######....#
|
||||
#...................................................................................................#######.....>######....#
|
||||
#..........................................................................................................................#
|
||||
#..........................................................................................................................#
|
||||
#..........................................................................................................................#
|
||||
|
@ -73,7 +74,7 @@ dungeon3="""
|
|||
#.............................................................................................#........#........#..........#
|
||||
#.............................................................................................#........#........#..........#
|
||||
#.............................................................................................#........#........#..........#
|
||||
-->...........................................................................................#........#........#..........#
|
||||
--><..........................................................................................#........#........#..........#
|
||||
#.............................................................................................#........#........#..........#
|
||||
#.............................................................................................#........#........#..........#
|
||||
#.............................................................................................#........#........#..........#
|
||||
|
@ -97,7 +98,9 @@ heroz=0
|
|||
hero_Gold=0
|
||||
hero_Wurstsemmel=3000
|
||||
hero_hunger=0
|
||||
hero_hp=1
|
||||
hero_hp=1000
|
||||
hero_key=0
|
||||
hero_special_key=0
|
||||
|
||||
#level=list(dungeon)
|
||||
level=[]
|
||||
|
@ -110,7 +113,7 @@ for d in (dungeon1,dungeon2,dungeon3):
|
|||
|
||||
|
||||
while True:
|
||||
if hero_hunger>30:
|
||||
if hero_hunger>1000:
|
||||
print("Du bist verhungert!\nVersager")
|
||||
break
|
||||
if hero_hunger<-1:
|
||||
|
@ -131,7 +134,7 @@ while True:
|
|||
print(c,end="")
|
||||
print()
|
||||
|
||||
command=input("Gold:{} \nWurstsemmeln:{} \nHunger:{}\nLeben:{}\n?".format(hero_Gold,hero_Wurstsemmel,hero_hunger,hero_hp))
|
||||
command=input("Gold:{} \nWurstsemmeln:{} \nHunger:{}\nLeben:{}\nKeys:{}\n?".format(hero_Gold,hero_Wurstsemmel,hero_hunger,hero_hp,hero_key))
|
||||
|
||||
|
||||
dx=0
|
||||
|
@ -160,13 +163,62 @@ while True:
|
|||
print("Hilfe!!!\nkein essen mehr!!")
|
||||
if command=="Zaubertrank":
|
||||
hero_hp+=100
|
||||
if command=="fly up":
|
||||
if heroz==0:
|
||||
print("Du bist schon im obersten Level")
|
||||
else:
|
||||
heroz-=1
|
||||
if command=="fly down":
|
||||
if heroz==len(level)-1:
|
||||
print("Du bist schon im untersten Level")
|
||||
else:
|
||||
heroz+=1
|
||||
|
||||
# ---in Wand gelaufen---
|
||||
target=level[heroz][heroy+dy][herox+dx]
|
||||
if target=="#":
|
||||
dx=0
|
||||
dy=0
|
||||
print("Autch ich bin in eine Mauer gelaufen!\nIch werde von einem Trottel kontrolliert!!")
|
||||
|
||||
#In Teleporter gelaufen---
|
||||
elif target=="*":
|
||||
#try to find legal field
|
||||
for v in range(100):
|
||||
tx=random.randint(-5,5)+herox
|
||||
ty=random.randint(-4,4)+heroy
|
||||
|
||||
if level[heroz][ty][tx]=="." or level[heroz][ty][tx]=="*":
|
||||
herox=tx
|
||||
dx=0
|
||||
heroy=ty
|
||||
dy=0
|
||||
break
|
||||
else:
|
||||
dx=0
|
||||
dy=0
|
||||
#print("Der teleporter katapultiert dich woanders hin!")
|
||||
#dx=random.randint(-5,5)
|
||||
#dy=random.randint(-5,5)
|
||||
# ---- in türe gelaufen ? -----
|
||||
elif target=="d":
|
||||
if hero_key>0:
|
||||
hero_key-=1
|
||||
level[heroz][heroy+dy][herox+dx]="."
|
||||
else:
|
||||
dx=0
|
||||
dy=0
|
||||
print("Hife!\nIch bin gegen eine geslossene Tür ohne Schlüssel gelaufen!\nIch werde von einem Trottel kontrolliert!!")
|
||||
|
||||
#----In Spezialtüre gelaufen?----
|
||||
elif target=="s":
|
||||
if hero_special_key>0:
|
||||
hero_special_key-=1
|
||||
level[heroz][heroy+dy][herox+dx]="."
|
||||
else:
|
||||
dx=0
|
||||
dy=0
|
||||
print("Hife!\nIch bin gegen eine geslossene Tür ohne Schlüssel gelaufen!\nIch werde von einem Trottel kontrolliert!!")
|
||||
|
||||
# in Monster gelaufen?
|
||||
#target=level[herox+dx]
|
||||
#---Gorilla anfang---
|
||||
|
@ -188,6 +240,25 @@ while True:
|
|||
dx=0
|
||||
dy=0
|
||||
# -------- gorilla ende ---------
|
||||
#---Boss anfang---
|
||||
if target=="B":
|
||||
print("Der Boss hat die Prinnzessin enntführt!")
|
||||
print("Der Boss kämpft proffessionell!")
|
||||
schaden=random.randint(50,100)
|
||||
hero_hp-=schaden
|
||||
print("Du erleidest {} Schaden".format(schaden))
|
||||
if hero_hp<1:
|
||||
print:("Du stirbst!\nVersager!")
|
||||
break
|
||||
sieg=0.1
|
||||
if random.random() < sieg:
|
||||
level[heroz][heroy+dy][herox+dx]="."
|
||||
print("Du erledigst heldenhaft den Boss!!")
|
||||
hero_special_key+=1
|
||||
else:
|
||||
print("Du Verlierst!")
|
||||
dx=0
|
||||
dy=0
|
||||
#---kobold anfang---
|
||||
if target=="K":
|
||||
print("Ein Kobold blockiert deinen Weg!")
|
||||
|
@ -221,8 +292,21 @@ while True:
|
|||
print("Du hast die Prinzessin befreit!")
|
||||
level[heroz][heroy][herox]="p"
|
||||
break
|
||||
|
||||
|
||||
if stuff=="<":
|
||||
command2=input("Du bist auf einer Treppe gelandet.\nWillst du ein Stockwerk tiefer gehen?")
|
||||
if command2=="y":
|
||||
heroz+=1
|
||||
else:
|
||||
print("Ok, dann eben nicht.")
|
||||
if stuff==">":
|
||||
command3=input("Du bist auf einer Treppe gelandet.\nWillst du ein Stockwerk höher gehen?")
|
||||
if command3=="y":
|
||||
heroz-=1
|
||||
else:
|
||||
print("Ok, dann eben nicht.")
|
||||
if stuff=="k":
|
||||
hero_key+=1
|
||||
level[heroz][heroy][herox]="."
|
||||
|
||||
print("Ende")
|
||||
|
||||
|
|
Reference in New Issue