示例#1
0
                running = False
                break
            elif event.type == KEYDOWN and event.key == K_LSHIFT:
                combo_select = True
            elif event.type == KEYUP and event.key == K_LSHIFT:
                combo_select = False
            elif event.type == MOUSEBUTTONUP:
                pos = pygame.mouse.get_pos()

                # handle clicking on available sigil
                if player.can_get_sigil():
                    clicked_sprites = [s for s in game_state.available_sprites if
                                       s.rect.collidepoint(pos)]
                    for sprite in clicked_sprites:
                        # we clear combo select if you click something else
                        player.clear_selection()
                        sprite.claim()

                # handle clicking on a sigil in your spellbook
                clicked_in_spellbook = [s for s in player.spellbook if
                                        s.rect.collidepoint(pos)]
                for sprite in clicked_in_spellbook:
                    # if we're not selecting spells for a combo, proceed as normal
                    if not combo_select:
                        # if the player clicks a non-combo sigil, cast it
                        if sprite not in player.combo_select:
                            # we clear combo select if you click something else
                            player.clear_selection()
                            sprite.cast()
                        # otherwise, cast the combo it's in
                        else: