本文整理汇总了Python中tile.Tile.make_tiles方法的典型用法代码示例。如果您正苦于以下问题:Python Tile.make_tiles方法的具体用法?Python Tile.make_tiles怎么用?Python Tile.make_tiles使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tile.Tile
的用法示例。
在下文中一共展示了Tile.make_tiles方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from tile import Tile [as 别名]
# 或者: from tile.Tile import make_tiles [as 别名]
def __init__(self):
super(Game, self).__init__()
self.level = Level(1, [10,11,12,25], [11,12])
Tile.make_tiles(self.size, self.level)
self.background = Background(source='img/background.png')
self.size = self.background.size
self.add_widget(self.background)
self.character = Character(pos=(20, self.height/2))
self.add_widget(self.character)
Clock.schedule_interval(self.update, 1.0/60.0)
示例2: __init__
# 需要导入模块: from tile import Tile [as 别名]
# 或者: from tile.Tile import make_tiles [as 别名]
def __init__(self, level):
super(Game, self).__init__()
self.level = Level.load_level(level)
self.background = Sprite(source='img/background.PNG')
self.size = self.background.size
self.player = None
self.boxes = []
# Initiate the game by creating tiles
Tile.make_tiles(self.size, self.level)
# Add bg widget first to not cover other sprites
self.add_widget(self.background)
# Add proper widgets for every non-empty tile in the Tile.List
for tile in Tile.List:
if tile.type != 'empty':
if Tile.get_tile(tile.number - Tile.V).walkable:
self.add_widget(Sprite(
source=Tile.image_files[tile.type],
pos=(tile.x, tile.y)), index=2)
else:
self.add_widget(Sprite(
source=Tile.image_files[tile.type + '_edge'],
pos=(tile.x, tile.y - SPRITE_EDGE_OFFSET)))
for tile in self.level.boxspawn:
self.boxes.append(Box(tile, self))
self.player = Player(self.level.playerspawn, self)
self.fps_lab = Label(
text='FPS: ' + str(Clock.get_rfps()),
pos=(2, self.height - 110),
font_name=APP_FONT,
font_size=18,
color=(240, 240, 240, 0.8))
self.add_widget(self.fps_lab)
self.add_widget(Label(
text="Level {}".format(self.level.level),
pos=(0, self.height - 80),
font_name=APP_FONT,
font_size=18,
color=(240, 240, 240, 0.8)))
# Schedule an interval for the game update function
Clock.schedule_interval(self.update, 1.0/60.0)