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


Python Monster.current_trigger方法代码示例

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


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

示例1: createMonsters

# 需要导入模块: from monster import Monster [as 别名]
# 或者: from monster.Monster import current_trigger [as 别名]
    def createMonsters(self):
        Green = (0, 255, 0)
        Pink = (255, 18, 248)
        level_rect = pygame.Rect(10, 10, 470, 310)
        level_rect2 = pygame.Rect(220, 85, 200, 100)
        levelFont = pygame.font.Font("fonts/BLOODY.ttf", 60)
        level_text = levelFont.render("Moving to Level ", False, Pink)
        level_text2 = levelFont.render(str(self.level), False, Pink)
        
### the transition surface between levels
        if self.trigger == False and self.level > 1:
            
            self.windowSurface.fill(Green)
            ## blit statement for the "changing levels
            self.windowSurface.blit(level_text, level_rect)
            self.windowSurface.blit(level_text2, level_rect2)
            pygame.display.update()
            #if self.elapsed_time > (3000):    
            self.monster = True
            pygame.time.wait(3000)
            self.character.rect.center = (240, 160)
            self.direction = "stop"
            
            ## blits the super Monsters at the beginning of each level
            superMonster2 = Monster("crab")
            #superMonster2.image = pygame.image.load("img/superMonster_crab.png").convert_alpha()
            superMonster2.rect.center = (random.randint(400, 500), random.randint(-120, 20))
            superMonster2.speed_trigger = 1
            superMonster2.current_trigger = 0
            self.superMonster2_group.empty()
            if self.level >= 6:
                self.superMonster2_group.add(superMonster2)
            
            superMonster = Monster("mummy")
            #superMonster.image = pygame.image.load("img/SuperMonster_mummy.png")
            #superMonster.image.convert_alpha()
            superMonster.rect.center = (random.randint(400, 500), random.randint(150, 340))
            superMonster.speed_trigger = 1
            superMonster.current_trigger = 0
            self.superMonster_group.empty()
            if self.level >= 3:    
                self.superMonster_group.add(superMonster)
                
        ### counter for the monsters speed
            zombie = Monster("zombie")
            zombie.speed_trigger = 2
            zombie.current_trigger = 0
            
            
            
##### instantiates the objects and addes them to the forest_group list
            if self.level == 2:
                tree = Plant()
                tree.rect.center = (15, 45)
                tree2 = Plant()
                tree2.rect.center = (460, 45)
                tree3 = Plant()
                tree3.rect.center = (15, 294)
                tree4 = Plant()
                tree4.rect.center = (460, 294)
                self.forest_group.add(tree, tree2, tree3, tree4)
                
            
            if self.level == 3:
                self.forest_group.empty()
                for x in range(10, 470, 32):
                    y = 35
                    tree = Plant()
                    tree.rect.center = (x, y)
                    self.forest_group.add(tree)
            
            if self.level == 4:
                for x in range(10, 470, 32):
                    y = 310
                    cactus = Plant()
                    cactus.image = pygame.image.load("img/cactus.png")
                    cactus.image.convert_alpha()
                    cactus.rect.center = (x, y)
                    self.forest_group.add(cactus)
            
            if self.level == 5:
                self.forest_group.empty()
                for x1 in range(40, 440, 30):
                    y1 = 50
                    pillar = Plant()
                    pillar.image = pygame.image.load("img/pillar.png")
                    pillar.image.convert_alpha()
                    pillar.rect.center = (x1, y1)
                for x2 in range(40, 440, 30):
                    y2 = 100
                    pillar2 = Plant()
                    pillar2.image = pygame.image.load("img/pillar.png")
                    pillar.image.convert_alpha()
                    pillar2.rect.center = (x2, y2)
                for x3 in range(40, 440, 30):
                    y3 = 150
                    pillar3 = Plant()
                    pillar3.image = pygame.image.load("img/pillar.png")
                    pillar3.image.convert_alpha()
                    pillar3.rect.center = (x3, y3)
#.........这里部分代码省略.........
开发者ID:KaiyoteSoft,项目名称:2nd-Gen.-Swarm,代码行数:103,代码来源:timer.py


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