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


Python Hud.updateScore方法代码示例

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


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

示例1: Game

# 需要导入模块: from hud import Hud [as 别名]
# 或者: from hud.Hud import updateScore [as 别名]

#.........这里部分代码省略.........
                self.player.checkColl(tempEnemy, self.cam, self)
            #Check enemy deaths
            for tempEnemy in self.enemyList:
                if tempEnemy.deathFlag:
                    self.score.total += 100
                    self.makeLineBurst( tempEnemy.rect.centerx, tempEnemy.rect.centery, tempEnemy.deathAngle, 60, 200, 50, (255,255,0), 0.1, True )
                    self.makeLineBurst( tempEnemy.rect.centerx, tempEnemy.rect.centery, tempEnemy.deathAngle, 60, 200, 50, (255,255,255), 0.1, True )
                    self.makeLineBurst( self.player.rect.centerx, self.player.rect.centery, 0, 360, 100, 50, (255,255,255), 0.05, True )
                    self.makeLineBurst( self.player.rect.centerx, self.player.rect.centery, 0, 360, 100, 40, (255,0,0), 0.05, True )
                    self.enemyExplo.play()
                    self.enemyList.remove( tempEnemy )
                    self.spawnEnemy()

            
            #Effect update
            for effect in self.effectInstances:
                if not effect.active:
                    self.effectInstances.remove( effect )
            
            #Shake and Decay
            self.camShakeFactor = self.camShakeFactor - ( self.camShakeFactor * self.camShakeDecayFactor )
            if ( self.camShakeFactor < 1 ):
                self.camShakeFactor = 0
            self.cam.shake(random.random() * self.camShakeFactor, random.random() * self.camShakeFactor)
            
            #Player boost effect
            if ( self.player.boosting ):
                self.makeLineBurst( self.player.rect.centerx, self.player.rect.centery, -self.player.ang  * 180 / math.pi + 180, 30, 3, 30, (255,255,155), 0.1, True )
                self.makeLineBurst( self.player.rect.centerx, self.player.rect.centery, -self.player.ang  * 180 / math.pi + 180, 30, 3, 30, (255,0,0), 0.1, True )
            if ( self.player.thrusting ):
                self.makeLineBurst( self.player.rect.centerx, self.player.rect.centery, -self.player.ang  * 180 / math.pi + 180, 20, 2, 20, (255,255,255), 0.1, True )
                
            #Update Score in HUD
            self.hud.updateScore(self.score.getTotal())
            
            #Death
            if self.player.dead and self.player.canMakeDeadEffect:
                self.player.canMakeDeadEffect = False
                self.shakeScreen( 64 )
                self.soundCon.playDeathSound()
                self.deathSound.play()
                #self.makeExplosion( 500, 500, "Images/Effects/Explosion2Spr.png", 200, 200, 8, 8, True)
                self.makeLineBurst( self.player.rect.centerx, self.player.rect.centery, 0, 360, 200, 30, (255,255,0), 0.1, True )
                self.makeLineBurst( self.player.rect.centerx, self.player.rect.centery, 0, 360, 200, 30, (255,0,0), 0.1, True )
                self.makeLineBurst( self.player.rect.centerx, self.player.rect.centery, 0, 360, 100, 30, (255,155,0), 0.05, True )
                self.makeLineBurst( self.player.rect.centerx, self.player.rect.centery, 0, 360, 100, 40, (255,0,0), 0.05, True )
                self.makeLineBurst( self.player.rect.centerx, self.player.rect.centery, 0, 360, 100, 50, (255,255,255), 0.05, True )
                self.player.numLives -= 1
                if ( self.player.numLives <= 0 ):
                    self.doFade = True
                    self.player.currentDeadTime = 30
            if ( self.player.reformEffect ):
                self.player.reformEffect = False;
                self.spawnSound.play()
                self.makeLineBurst( self.player.rect.centerx, self.player.rect.centery, 0, 360, 150, 15, (255,255,255), 0.1, False )
                self.makeLineBurst( self.player.rect.centerx, self.player.rect.centery, 0, 360, 150, 30, (255,255,255), 0.1, False )
                self.makeLineBurst( self.player.rect.centerx, self.player.rect.centery, 0, 360, 150, 50, (255,255,255), 0.1, False )
            
            
            self.timer = pygame.time.get_ticks()
            
            
    def shakeScreen(self, magnitude):
        self.camShakeFactor = magnitude #Magnitude of shake
    
    def makeLineBurst(self, x, y, direction, spread, count, maxSpeed, color, lerpPercent, doRandom):
开发者ID:BrettMcNeff,项目名称:TBA,代码行数:70,代码来源:game.py


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