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


Python Hud.createHudElements方法代码示例

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


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

示例1: World

# 需要导入模块: from hud import Hud [as 别名]
# 或者: from hud.Hud import createHudElements [as 别名]
class World (object):
    
    def __init__(self):
        super(World, self).__init__()

        self.frames = 1

        # this is normal difficulty by default
        # easy would prolly be .7ish and hard.. 1.3 or so?
        self.difficulty = 0.7
        self.spawnFreq = 10
        self.scrollPosition = 0
        self.scrollSpeed = 3
        self.endPosition = FRAMES_UNTIL_BOSS * self.scrollSpeed
        self.startScreen = True
        self.helpScreen = False
        self.difficultyScreen = False
        self.bossMode = False
        self.gameOver = False
        self.winScreen = False
        self.score = 0
        self.call_popcorn = 0
        self.boss_music=False
        self.holdingLeftMouseButton = False

        #for keeping track of for the win screen!
        self.numEnemiesAppeared = 0
        self.numEnemiesDestroyed = 0
        self.numViruses = 0
        self.numWorms = 0
        self.numPopUps = 0

        self.playerGroup = pygame.sprite.GroupSingle()
        self.enemies = pygame.sprite.Group()
        self.pickups = pygame.sprite.Group()
        self.bullets = pygame.sprite.Group()
        self.mines = pygame.sprite.Group()
        self.backgrounds = pygame.sprite.Group()
        self.spawnBkg()
        
        # sprite groups listed in draw order (lowest sprite get drawn first)
        self.spriteGroups = [self.backgrounds, self.mines, self.pickups, self.bullets, self.enemies, self.playerGroup]
        
        self.hud = Hud()


        
    def spawnWorld(self):
        self.StartScreen = False
        playerPos = (PLAY_WIDTH / 2, SCREEN_HEIGHT - 50)
        pygame.mouse.set_pos(playerPos)
        self.player = Player(self, playerPos)
        self.playerGroup.add(self.player)


        pygame.mixer.music.load("data/music/Main.mp3")
        pygame.mixer.music.play()
        self.hud.createHudElements()
        self.frames = 1

        self.scrollPosition = 0
        self.scrollSpeed = 3


    def spawnBkg(self):
        bkg = Bkg()
        self.backgrounds.add(bkg)
        
    def spawnCtrl(self):
        ctrl = Ctrl()
        self.pickups.add(ctrl)
        
    def spawnAlt(self):
        alt = Alt()
        self.pickups.add(alt)
    
    def spawnDel(self):
        d = Del()
        self.pickups.add(d)
        
    def spawnVirus(self, position):
        self.numEnemiesAppeared += 1
        enemy = Virus(position)
        self.enemies.add(enemy)

    def spawnDoubleVirus(self, position):
        self.numEnemiesAppeared += 1
        enemy = DoubleVirus(self, position)
        self.enemies.add(enemy)
        
    def spawnTripleVirus(self):
        self.numEnemiesAppeared += 1
        enemy = TripleVirus(self)
        self.enemies.add(enemy)
        
    def spawnWorm(self):
        self.numEnemiesAppeared += 1
        position1 = random.randint(195,PLAY_WIDTH-50)
        position2 = 10
        position = position1, position2
#.........这里部分代码省略.........
开发者ID:dandelarosa,项目名称:unaffectedindicator,代码行数:103,代码来源:world.py


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