本文整理汇总了Python中models.Game.turn_count方法的典型用法代码示例。如果您正苦于以下问题:Python Game.turn_count方法的具体用法?Python Game.turn_count怎么用?Python Game.turn_count使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Game
的用法示例。
在下文中一共展示了Game.turn_count方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_game
# 需要导入模块: from models import Game [as 别名]
# 或者: from models.Game import turn_count [as 别名]
def get_game(game_id):
game = db.GqlQuery('SELECT * from Game ' +
'WHERE game_id = :1',
game_id)
if game.count() < 1:
game = Game()
import uuid
grid = []
for i in range(0, 10):
row = []
for j in range(0, 10):
row.append(randint(0,3))
grid.append(row)
game.tiles = json.dumps(grid)
player = {
'heartrate': 50,
'heartbeats': max_beats,
'x': 5,
'y': 5,
'abilities':[ 0, 0, 0, 0 ],
'stupid':False
}
monsters = {}
for monster in elements.keys():
monsters[monster] = {
'x': -1,
'y': -1
}
powerups = []
active_monsters = []
game.player = json.dumps(player)
game.monsters = json.dumps(monsters)
game.active_monsters = json.dumps(active_monsters)
game.powerups = json.dumps(powerups)
game.game_id = game_id
game.turn_count = 0
game.is_dead = 0
game.drop_chance = start_drop_rate
game.put()
else:
game = game[0]
return game