當前位置: 首頁>>代碼示例>>Python>>正文


Python Surface.get_tile_by_number方法代碼示例

本文整理匯總了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)
開發者ID:mmoreirasouza,項目名稱:pythonzombiegame,代碼行數:9,代碼來源:level1.py

示例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])
開發者ID:mmoreirasouza,項目名稱:pythonzombiegame,代碼行數:12,代碼來源:level1.py

示例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")
開發者ID:mmoreirasouza,項目名稱:pythonzombiegame,代碼行數:32,代碼來源:main.py


注:本文中的surface.Surface.get_tile_by_number方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。