本文整理汇总了Python中Ship.changeShotSingle方法的典型用法代码示例。如果您正苦于以下问题:Python Ship.changeShotSingle方法的具体用法?Python Ship.changeShotSingle怎么用?Python Ship.changeShotSingle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ship
的用法示例。
在下文中一共展示了Ship.changeShotSingle方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Controller
# 需要导入模块: import Ship [as 别名]
# 或者: from Ship import changeShotSingle [as 别名]
#.........这里部分代码省略.........
outputFile.write(string)
inserted = True
outputFile.write(line)
File.close()
outputFile.close()
os.remove(inputPath)
os.rename(outputPath, inputPath)
break
# blit txtbx on the sceen
txtbx.draw(self.screen)
# refresh the display
pygame.display.flip()
time.sleep(1)
return "Exit"
if event.type == USEREVENT+2:
self.spaceGroup.update()
if event.type == USEREVENT+3:
self.ship.canShoot = True
if event.type == USEREVENT+4:
powerUp = self.powerUpGroup.sprites()
for x in range(len(self.powerUpGroup)):
if pygame.sprite.collide_circle(self.ship, powerUp[x]):
powerUp[x].power(self.ship)
powerUp[x].kill()
shipPowerUp.play()
self.shipGroup.update()
self.enemyGroup.update()
self.bossGroup.update()
if event.type == USEREVENT+5:
enemyList = self.enemyGroup.sprites()
for i in range(len(enemyList)):
enemyList[i].shoot()
bossList = self.bossGroup.sprites()
for boss in bossList:
boss.shoot()
if event.type == USEREVENT+6:
sType = randint(0, 1)
path = "images\\Enemy_" + str(sType) + ".png"
initX = randint(100, 400)
initDX = randint(-1, 1)
initDY = randint(1, 1)
enemy = Enemy(path, initX, 0, initDX, initDY, sType, self)
self.enemyGroup.add(enemy)
if event.type == USEREVENT+7:
xcoord = randint(100, 400)
ycoord = randint(100, 450)
pType = randint(0, 2)
pUp = PowerUp((xcoord, ycoord), pType)
self.powerUpGroup.add(pUp)
if event.type == USEREVENT:
boss = Boss(0, self)
self.bossGroup.add(boss)
pygame.time.set_timer(pygame.USEREVENT+6, 0)
pygame.time.set_timer(pygame.USEREVENT, 0)
if event.type == KEYDOWN:
if event.key == K_w and gCount == 0:
gCount = 1
if event.key == K_a and gCount == 1:
gCount = 2
if event.key == K_l and gCount == 2:
gCount = 3
if event.key == K_r and gCount == 3:
gCount = 4
if event.key == K_i and gCount == 4:
gCount = 5
if event.key == K_d and gCount == 5:
gCount = 6
if event.key == K_e and gCount == 6:
gCount = 7
if event.key == K_r and gCount == 7:
sc = 999999999999999
gCount = 8
keys = pygame.key.get_pressed()
if keys[K_ESCAPE]:
pauseMenu = PauseMenu.Menu(self)
action = pauseMenu.pause(self)
if action != "Continue":
return action
if self.ship.invincible and time.time() - self.ship.invincTime >= self.ship.duration:
self.ship.switchIndex(0)
self.ship.invincible = False
if self.ship.shotNumber == 3 and time.time() - self.ship.triShotTime >= self.ship.duration1:
self.ship.changeShotSingle()
pygame.display.update()
self.repaint()
self.screen.blit(scRendered, (500-scRendered.get_rect().right-2, 2)) #score
self.screen.blit(mtRendered, (500-mtRendered.get_rect().right-2, 28)) #multiplier