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


Python Ship.giveShield方法代码示例

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


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

示例1: Controller

# 需要导入模块: import Ship [as 别名]
# 或者: from Ship import giveShield [as 别名]

#.........这里部分代码省略.........
                    self.bulletGroup.update()
                    enemyList = self.enemyGroup.sprites()
                    bossList = self.bossGroup.sprites()
                    for x in range(len(bulletList)):
                        if bulletList[x].team == 0:
                            for boss in bossList:
                                if pygame.sprite.collide_circle(bulletList[x], boss):
                                    bulletList[x].kill()
                                    if boss.loseHealth(1):
                                        sc += 500*multiplier
                                        boss.kill()
                                        pygame.time.set_timer(pygame.USEREVENT+6, self.diff)
                                        pygame.time.set_timer(pygame.USEREVENT, 60000)

                        for i in range(len(enemyList)):
                            if bulletList[x].team == 0 and pygame.sprite.collide_circle(bulletList[x], enemyList[i]):
                                enemyDeath.play()
                                sc += 50*multiplier
                                multiplier += 1
                                enemyList[i].kill()
                                bulletList[x].kill()

                        if bulletList[x].team == 1 and pygame.sprite.collide_circle(self.ship, bulletList[x]):
                            bulletList[x].kill()
                            if not self.ship.invincible:
                                if self.ship.lives == 1:
                                    shipDeath.play()
                                else:
                                    shipShieldDeath.play()

                                self.ship.loseLife()
                                heartNumber -= 1
                                multiplier = 1
                                self.ship.giveShield(2, 1)

                            if self.ship.lives <= 0:
                                pygame.time.set_timer(pygame.USEREVENT+1, 0)                   #Timer for bullet
                                pygame.time.set_timer(pygame.USEREVENT+2, 0)                  #Timer for background
                                pygame.time.set_timer(pygame.USEREVENT+3, 0)                  #Timer for shooting
                                pygame.time.set_timer(pygame.USEREVENT+4, 0)                   #Timer for moving
                                pygame.time.set_timer(pygame.USEREVENT+5, 0)                  #Timer for Enemy Shooting
                                pygame.time.set_timer(pygame.USEREVENT+6, 0)                  #Timer for enemy spawn
                                pygame.time.set_timer(pygame.USEREVENT+7, 0)                #Timer for Power Up spawn
                                pygame.time.set_timer(pygame.USEREVENT, 0)                 #Timer for boss spawn
                                txtbx = eztext.Input(maxlength=25, color=(0,0,0), prompt='Enter name: ')
                                while True:
                                    events = pygame.event.get()
                                    # process other events
                                    for event in events:
                                        # close if x button is pressed
                                        if event.type == QUIT: 
                                            return "Exit"

                                    # clear the screen
                                    self.screen.fill((255,255,255))
                                    # update txtbx
                                    s = txtbx.update(events)
                                    if s != None:
                                        string = str(sc) + "\t" + s + "\n"
                                        if self.diff == 1000:
                                            inputPath = "outputs\\Easy.txt"
                                            outputPath = "outputs\\Easy_New.txt"
                                            File = open(inputPath, 'r')
                                            outputFile = open(outputPath, "w")
                                            inserted = False
                                            for line in File:
开发者ID:Wesleywa7,项目名称:Operation-Catapult-Bullet-Hell,代码行数:70,代码来源:Controller.py


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