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


Python Score.getComboScore方法代码示例

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


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

示例1: testgetComboScore

# 需要导入模块: from score import Score [as 别名]
# 或者: from score.Score import getComboScore [as 别名]
 def testgetComboScore(self): 
   'Test if the getComboScore is correct for five instances'
   get1 = Score()
   combo = 20
   get1.getComboScore(combo)
   comboScore1 = 400
   self.assertEqual(get1.returnCombo(),comboScore1)
   get2 = Score()
   combo = 10
   get2.getComboScore(combo)
   comboScore2 = 100
   self.assertEqual(get2.returnCombo(),comboScore2)
   get3 = Score()
   combo = 5
   get3.getComboScore(combo)
   comboScore3 = 30
   self.assertEqual(get3.returnCombo(),comboScore3)
   get4 = Score()
   combo = 3
   get4.getComboScore(combo)
   comboScore4 = 10
   self.assertEqual(get4.returnCombo(),comboScore4)
   get5 = Score()
   combo = 7
   get5.getComboScore(combo)
   comboScore5 = 0
   self.assertEqual(get5.returnCombo(),comboScore5)
开发者ID:EliasJonsson,项目名称:Golf-Solitaire,代码行数:29,代码来源:test_golfkapall.py

示例2: PlayScreen

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

#.........这里部分代码省略.........
            # Only want to run this if loop once
            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
开发者ID:EliasJonsson,项目名称:Golf-Solitaire,代码行数:70,代码来源:Screens.py


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