本文整理匯總了Python中GameState.load_game方法的典型用法代碼示例。如果您正苦於以下問題:Python GameState.load_game方法的具體用法?Python GameState.load_game怎麽用?Python GameState.load_game使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類GameState
的用法示例。
在下文中一共展示了GameState.load_game方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: take_turn
# 需要導入模塊: import GameState [as 別名]
# 或者: from GameState import load_game [as 別名]
#.........這裏部分代碼省略.........
# TODO: Make movement cost relative to terrain. (add terrain cost to TILE) WATER / TAR / OIL / SAND = Slower, Road / Trail = Fsater
# TODO: Make turns not pass as you bumb into walls.
# TODO: Add 'Auto-Explore' --- Search for Not self.Explored, path to it as if you right clicked.
if key == terminal.TK_KP_8 or key == terminal.TK_UP:
GameState.player_move_or_interact(0, -1)
return self.end_turn(Constants.TURN_COST)
elif key == terminal.TK_KP_2 or key == terminal.TK_DOWN:
GameState.player_move_or_interact(0, 1)
return self.end_turn(Constants.TURN_COST)
elif key == terminal.TK_KP_4 or key == terminal.TK_LEFT:
GameState.player_move_or_interact(-1, 0)
return self.end_turn(Constants.TURN_COST)
elif key == terminal.TK_KP_6 or key == terminal.TK_RIGHT:
GameState.player_move_or_interact(1, 0)
return self.end_turn(Constants.TURN_COST)
elif key == terminal.TK_KP_7: # or (terminal.TK_LEFT and terminal.TK_UP):
GameState.player_move_or_interact(-1, -1)
return self.end_turn(Constants.TURN_COST)
elif key == terminal.TK_KP_9:
GameState.player_move_or_interact(1, -1)
return self.end_turn(Constants.TURN_COST)
elif key == terminal.TK_KP_1:
GameState.player_move_or_interact(-1, 1)
return self.end_turn(Constants.TURN_COST)
elif key == terminal.TK_KP_3:
GameState.player_move_or_interact(1, 1)
return self.end_turn(Constants.TURN_COST)
elif key == terminal.TK_KP_5:
return self.end_turn(Constants.TURN_COST)
elif key == terminal.TK_X:
GameState.current_level.require_recompute()
Constants.DEBUG = not Constants.DEBUG
GameState.render_all()
elif key == terminal.TK_G:
# pick up an item
for object in GameState.current_level.get_all_objects(): # look for an item in the player's tile
if object.x == self.owner.x and object.y == self.owner.y and object.item:
object.item.pick_up()
break
elif key == terminal.TK_F:
for obj in GameState.get_all_equipped(self.owner):
if obj.owner.ranged:
outcome = obj.owner.ranged.fire()
if outcome == 'cancelled':
return 0
else:
return self.end_turn(Constants.TURN_COST)
elif key == terminal.TK_B:
title = "Beastiary"
text = '\n\nDrag Header to move window\n\n'
pal = UI.Palette(width=20, height=20, title='Title', text=text)
pal.draw()
elif key == terminal.TK_COMMA and terminal.check(terminal.TK_SHIFT):
# go down stairs, if the player is on them
stairs = GameState.current_level.get_stairs()
if stairs.x == self.owner.x and stairs.y == self.owner.y:
GameState.next_level()
return 1
elif key == terminal.TK_ESCAPE:
GameState.save_game()
UI.display_mainMenu()
elif key == terminal.TK_L:
GameState.load_game()
return 1
elif key == terminal.TK_T:
GameState.add_animation('FadeText', {'origin': (self.owner.x, self.owner.y),
'target': (self.owner.x, self.owner.y-1)})
elif key == terminal.TK_O:
print GameState.current_level.fov_map
elif key == terminal.TK_RBRACKET:
equipped_ranged = [equip.name for equip in GameState.inventory if equip.equipment.is_equipped and equip.ranged]
if equipped_ranged[0] == "pistol":
new_weapon = [equip for equip in GameState.inventory if
equip.name == 'laser']
new_weapon[0].equipment.equip()
elif equipped_ranged[0] == "laser":
new_weapon = [equip for equip in GameState.inventory if
equip.name == 'rpg']
new_weapon[0].equipment.equip()
elif equipped_ranged[0] == "rpg":
new_weapon = [equip for equip in GameState.inventory if
equip.name == 'ice wand']
new_weapon[0].equipment.equip()
elif equipped_ranged[0] == "ice wand":
new_weapon = [equip for equip in GameState.inventory if
equip.name == 'pistol']
new_weapon[0].equipment.equip()
elif key == terminal.TK_LBRACKET:
pass
'''
示例2: continue_game
# 需要導入模塊: import GameState [as 別名]
# 或者: from GameState import load_game [as 別名]
def continue_game():
GameState.load_game()
return GameState.play_game()