本文整理匯總了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")