コード例 #1
0
 def display(self, board):
     # render text
     for i in range(9):
         for j in range(9):
             if self._board[i][j]:
                 c = (255, 0, 0)
             else:
                 c = (0, 128, 0)
             text = font.render(str(board[i][j]), True, c)
             h = text.get_height() - 5
             textpos = text.get_rect()
             textpos.centerx = screen.get_rect().centerx + j * h - 200
             textpos.centery = 50 + i * h
             screen.fill((255, 255, 255), textpos)
             screen.blit(text, textpos)
     pygame.display.flip()
コード例 #2
0
        #kill wasps with venom
        for burning in venom.all_shots:
            for buzzy in wasp.all_wasps:
                if burning.rect.colliderect(buzzy.rect):
                    buzzy.kill()
                    burning.kill()

        #kill spider with birds
        for humming in bird.all_birds:
            if humming.rect.colliderect(
                    spider.rect) and not spider.invulnerable():
                spider.kill()

        #kill spider with screen
        if not screen.get_rect().colliderect(
                spider.rect) and not spider.invulnerable():
            spider.kill()

        if spider.lives == 0:
            menu = 0
            music.stop_music()

        if victory_rect.collidepoint(spider.rect.center):
            menu = 0
            music.stop_music()

        timer.tick(config.display.frame_rate)
        frames += 1
    elif menu == 0:
        #main menu
        screen.blit_UI(main_menu, (0, 0))