本文整理汇总了Python中Map.positionCheck方法的典型用法代码示例。如果您正苦于以下问题:Python Map.positionCheck方法的具体用法?Python Map.positionCheck怎么用?Python Map.positionCheck使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Map
的用法示例。
在下文中一共展示了Map.positionCheck方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: getInput
# 需要导入模块: import Map [as 别名]
# 或者: from Map import positionCheck [as 别名]
def getInput():
options = [];
if Globals.gameState != "Load" and Globals.player.dead():
Globals.quitGame = True
else:
if(Globals.gameState == "Load"):
options.append(Selection("New Game", ["new", "new game"], "create()"))
options.append(Selection("Load Game", ["load", "load game"], "load()"))
if Globals.gameState == "Running":
options.append(Selection("Fight", ["fight", "fight something"], "testCombat()"))
options.append(Selection("Display Character",["display","display character"], "print(Globals.player)"))
if Globals.gameState == "Dungeon":
options.append(Selection("Move(N,S,E,W)",["n","north","s","south","e","east","w","west"],"Map.mapMain(valInput)"))
if Map.positionCheck() == [0,4]:
if Globals.getKey == False:
options.append(Selection("Get Key",["get","get key"],"Globals.getKey= True"))
elif Map.positionCheck() == [4,5]:
if Globals.doorUnlocked == False:
if Globals.getKey:
options.append(Selection("Unlock Door",["unlock","unlock door"],"Globals.doorUnlocked = True"))
if Map.positionCheck() == [2,4]:
options.append(Selection("Rest",["rest"],"Globals.player.rest()"))
options.append(Selection("Display Character",["display","display character"], "print(Globals.player)"))
if Globals.defeatBoss:
options.append(Selection("New Game +",["new","new game", "new game +"],"newGamePlus()"))
options.append(Selection("Cheat",["xyzzy"],"Globals.player.AP += 1000"))
if Globals.gameState == "Combat":
pass
if Globals.gameState != "Load" and Globals.gameState != "Combat":
if Globals.player.AP >= 100:
options.append(Selection("Level Up", ["level", "level up"], "level()"))
options.append(Selection("Save Game", ["save", "save game"], "save()"))
options.append(Selection("Exit Game", ["exit", "exit game"], "quitGame()"))
stroptions = "("
for i in range(0, len(options), 1):
stroptions += str(options[i])
if i < len(options)-1:
stroptions += ", "
stroptions += ")"
valid = False
selection = None
while not valid:
valInput = input("\nWhat would you like to do? " + str(stroptions) + "\n>").lower()
for sel in options:
if sel.validSel(valInput):
valid = True
selection = sel
break
exec(sel.codeToExecute)
示例2: save
# 需要导入模块: import Map [as 别名]
# 或者: from Map import positionCheck [as 别名]
def save():
print("Saving...")
if os.path.isfile("player.qso"):
os.remove("player.qso")
pickle.dump(Globals.player, open( "player.qso","wb"))
print("Save complete!")
if os.path.isfile("progress.qso"):
os.remove("progress.qso")
x,y = Map.positionCheck()
globalsList = [Globals.doorUnlocked, Globals.miniBoss, Globals.defeatBoss, Globals.getKey,x,y,Globals.whaleTrap,Globals.levelInit]
pickle.dump(globalsList, open( "progress.qso","wb"))
示例3: load
# 需要导入模块: import Map [as 别名]
# 或者: from Map import positionCheck [as 别名]
def load():
print("Loading")
if os.path.isfile("player.qso"):
Globals.player = pickle.load( open( "player.qso","rb"))
global loadingFlag
loadingFlag = True
Globals.gameState = "Dungeon"
print(Globals.player.name,"loaded successfully.")
a,b = Map.positionCheck()
globalsList = pickle.load( open("progress.qso","rb"))
Globals.doorUnlocked = globalsList[0]
Globals.miniBoss = globalsList[1]
Globals.defeatBoss = globalsList[2]
Globals.getKey = globalsList[3]
Map.position = [globalsList[4],globalsList[5]]
Map.roomDesc(globalsList[4],globalsList[5])
Globals.whaleTrap = globalsList[6]
Globals.levelInit = globalsList[7]
else:
print("Player not found")
示例4: create
# 需要导入模块: import Map [as 别名]
# 或者: from Map import positionCheck [as 别名]
def create():
Globals.player = Player()
Globals.gameState = "Dungeon"
a,b = Map.positionCheck()
Map.roomDesc(a,b)