当前位置: 首页>>代码示例>>Python>>正文


Python Score.normalMove方法代码示例

本文整理汇总了Python中score.Score.normalMove方法的典型用法代码示例。如果您正苦于以下问题:Python Score.normalMove方法的具体用法?Python Score.normalMove怎么用?Python Score.normalMove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在score.Score的用法示例。


在下文中一共展示了Score.normalMove方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: PlayScreen

# 需要导入模块: from score import Score [as 别名]
# 或者: from score.Score import normalMove [as 别名]

#.........这里部分代码省略.........
            self.initBoardMode = False

        # Get the mouse position
        mousepos = pygame.mouse.get_pos()

        # If we are in dragmode
        if self.dragmode:
            # and if mouse is pressed
            if isPressed:
                # make selected card follow mouse position, -50 to place cursor in center of card
                self.cardsImg[self.selectedCard][RECT][0] = mousepos[0]-50
                self.cardsImg[self.selectedCard][RECT][1] = mousepos[1]-50

            # Card released over pile, check if card can go to pile
            elif not isPressed and self.cardsImg[self.selectedCard][RECT].colliderect(self.cardsImg[pile.topCard()][RECT]) and Deck.isMatch(self.selectedCard, pile.topCard()):
                # the card can go to pile, move card from minideck to pile

                self.combo += 1

                #Play combo sound if combo
                if self.combo == 3 and self.sound:
                    play.combo(3)

                elif self.combo == 5 and self.sound:
                    play.combo(3)

                elif self.combo == 10 and self.sound:
                    play.combo(3)

                elif self.combo == 20 and self.sound:
                    play.combo(3)

                self.score.getComboScore(self.combo)
                self.score.normalMove()

                # find out in what minideck selected card was
                for minideck in minidecks:
                    # check if the card was in selected minideck
                    if self.selectedCard in minideck:
                        # pop the card from the minideck to the top of the pile
                        self.cardsImg[self.selectedCard][RECT] = self.cardsImg[pile.topCard()][RECT]
                        pile.put(minideck.pop())
                        
                        #update lastStock
                        self.lastStock = False

                        if self.sound:
                            play.placeCard() 
                        
                        # re-init dragmode
                        self.selectedCard = None
                        self.selectedCardOrigPosL = None
                        self.selectedCardOrigPosT = None
                        self.dragmode = False
                        break
            else:
                # card can't go to pile
                if self.sound and self.combo > 2:
                    play.comboBreaker()

                # reset combo counter
                self.combo = 0

                # move it back to its original position in minideck
                self.cardsImg[self.selectedCard][RECT][0] = self.selectedCardOrigPosL
                self.cardsImg[self.selectedCard][RECT][1] = self.selectedCardOrigPosT
开发者ID:EliasJonsson,项目名称:Golf-Solitaire,代码行数:70,代码来源:Screens.py


注:本文中的score.Score.normalMove方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。