def setUp(self): pygame.init() pygame.display.set_mode((1280, 720), 0, 32) self.map_test = levelLoad(1) self.controller = GameController(1, self.map_test)
def cardAreaDraw(x1, y1, x2, y2, selectedRolesList): cardBgFile = path('image/cardBg.jpg') cardBg_init = pygame.image.load(cardBgFile).convert() cardBg = pygame.transform.scale(cardBg_init, (x2 - x1, y2 - y1)) screen.blit(cardBg, (x1, y1)) #绘制道具区域,包含背景和道具 #传入的参数为工具区的左上和右下角坐标,以及工具列表 def toolAreaDraw(x1, y1, x2, y2, toolsList): toolBgFile = path('image/toolBg.jpg') toolBg_init = pygame.image.load(toolBgFile).convert() toolBg = pygame.transform.scale(toolBg_init, (x2 - x1, y2 - y1)) screen.blit(toolBg, (x1, y1)) #用于测试# pygame.init() screen = pygame.display.set_mode((750, 500), 0, 32) pygame.display.set_caption("test_combatScene") map_test = levelLoad(1) while True: for event in pygame.event.get(): if event.type == QUIT: # 接收到退出事件后退出程序 exit() selectedRoleList_test = [] toolsList_test = [] combatScene(map_test, selectedRoleList_test, toolsList_test, screen) pygame.display.update()
def reloadLevel(self, level): self.level = level self.map = levelLoad(self.level)