本文整理汇总了Python中surface.Surface.get_tile_by_number方法的典型用法代码示例。如果您正苦于以下问题:Python Surface.get_tile_by_number方法的具体用法?Python Surface.get_tile_by_number怎么用?Python Surface.get_tile_by_number使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类surface.Surface
的用法示例。
在下文中一共展示了Surface.get_tile_by_number方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_life
# 需要导入模块: from surface import Surface [as 别名]
# 或者: from surface.Surface import get_tile_by_number [as 别名]
def create_life(self):
spot_count = len(Level1.LIFE_SPOT)
spot_number = randint(0, spot_count - 1)
life_tile = Surface.get_tile_by_number(Level1.LIFE_SPOT[spot_number])
Life(life_tile.x, life_tile.y)
示例2: create_enemy
# 需要导入模块: from surface import Surface [as 别名]
# 或者: from surface.Surface import get_tile_by_number [as 别名]
def create_enemy(self, player):
spot_count = len(Level1.ENEMY_SPOT)
spot_number = randint(0, spot_count - 1)
enemy_tile = Surface.get_tile_by_number(Level1.ENEMY_SPOT[spot_number])
type_count = len(Enemy.Types)
type_index = randint(0, type_count - 1)
Enemy(enemy_tile.x, enemy_tile.y, player, Enemy.Types[type_index])
示例3: Level1
# 需要导入模块: from surface import Surface [as 别名]
# 或者: from surface.Surface import get_tile_by_number [as 别名]
life_image = pygame.image.load("images/life.png")
open_door = pygame.image.load("images/open_door.png")
closed_door = pygame.image.load("images/closed_door.png")
dynamite_sound = pygame.mixer.Sound("sounds/bomb.wav")
key_sound = pygame.mixer.Sound("sounds/key.ogg")
door_sound = pygame.mixer.Sound("sounds/door_creak_closing.wav")
pygame.mixer.music.load("sounds/zombie_theme.wav")
pygame.mixer.music.play(-1)
level = Level1()
surface = Surface(SURFACE_SIZE, TILE_SIZE, level)
end_tile = Surface.get_tile_by_number(173)
level.end = End(end_tile.x, end_tile.y)
player_position = Surface.get_tile_by_number(level.player_position)
player = Player(player_position.x, player_position.y, TILE_SIZE)
bg = pygame.image.load("images/bg.png")
game_screen = pygame.display.set_mode(SURFACE_SIZE)
pygame.display.set_caption("Zombie")