本文整理汇总了Python中Ship.ship方法的典型用法代码示例。如果您正苦于以下问题:Python Ship.ship方法的具体用法?Python Ship.ship怎么用?Python Ship.ship使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ship
的用法示例。
在下文中一共展示了Ship.ship方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: addship
# 需要导入模块: import Ship [as 别名]
# 或者: from Ship import ship [as 别名]
def addship(shiplist):
level = 0
while True:
level = int(raw_input("please enter ship level"))
if level <= 200 and level >= 0:
break
else:
print "invalid level, please enter again"
while True:
name = raw_input("please enter a shipname")
if name == 'Default':
shiplist.append(Ship.ship())
shiplist[-1].sta.level = level
break
elif name == 'Shimakaze':
shiplist.append(Shimakaze())
shiplist[-1].sta.level = level
break
elif name == 'Fletcher':
shiplist.append(Fletcher())
shiplist[-1].sta.level = level
break
elif name == 'Kongo':
shiplist.append(Kongo())
shiplist[-1].sta.level = level
break
elif name == 'Bismarck':
shiplist.append(Bismarck())
shiplist[-1].sta.level = level
break
elif name == 'NorthCarolina':
shiplist.append(NorthCarolina())
shiplist[-1].sta.level = level
break
elif name == 'Iowa':
shiplist.append(Iowa())
shiplist[-1].sta.level = level
break
elif name == 'Yamato':
shiplist.append(Yamato())
shiplist[-1].sta.level = level
break
elif name == 'Soyuz':
shiplist.append(Soyuz())
shiplist[-1].sta.level = level
break
elif name == 'G3':
shiplist.append(G3())
shiplist[-1].sta.level = level
break
elif name == 'Richelieu':
shiplist.append(Richelieu())
shiplist[-1].sta.level = level
break
else:
print "no such ship found, please enter again"
示例2: jouer
# 需要导入模块: import Ship [as 别名]
# 或者: from Ship import ship [as 别名]
def jouer(self):
##### PARAMETRES DE LA FENETRE #####
size = width, height = 1024,768
screen = pygame.display.set_mode(size, pygame.FULLSCREEN)
pygame.mouse.set_visible(False)
##### COMPTEURS #####
distanceTemp = 0
distance = 2
distanceLevelTemp = 0
level = 1
##### EXPLOSIONS #####
imagesTemp = [(pygame.transform.scale(pygame.image.load("images/ingame/explosion/explosion"+str(compt)+".png"), (70, 70)), 0.6) for compt in range(2,6)]
animObj = pyganim.PygAnimation(imagesTemp, loop=False)
imagesTemp = [(pygame.image.load("images/ingame/reachedRecord3.png"), 0.15), (pygame.image.load("images/ingame/reachedRecord2.png"),0.15), (pygame.image.load("images/ingame/reachedRecord1.png"),0.4)]
animReachedRecord = pyganim.PygAnimation(imagesTemp, loop=False)
##### IMAGES DU BACKGROUND #####
background = pygame.image.load("images/background/background.jpg")
i=0
isRecordBattu=False
##### JOUEUR #####
monVaisseau = Ship.ship([20, 0], self.player)
monVaisseau.raiseChaleurMax(self.player.additionalMissiles)
'''self.player.updateShopStateList(3,-1)'''
if self.player.shopStateList[3]==1:
monVaisseau.versionCanon=4
elif self.player.shopStateList[2]==1:
monVaisseau.versionCanon=3
elif self.player.shopStateList[1]==1:
monVaisseau.versionCanon=2
else:
monVaisseau.versionCanon=1
if self.player.shopStateList[4]==1:
monVaisseau.boosterOn = True
if self.player.shopStateList[5]==1:
monVaisseau.spoilerOn = True
##### MUSIQUE #####
if self.player.musicOn:
self.music.play(-1)
##### MENU COMMENCER #####
menuStartOn=True
musicAfterRecord = False
'''################################################################## ''
'' BOUCLE DE JEU ''
'' (img par img) ''
'' ##################################################################'''
while 1:
''' VITESSE D'AFFICHAGE '''
clock = pygame.time.Clock()
FRAMES_PER_SECOND = 35
deltat = clock.tick(FRAMES_PER_SECOND)
'''APPUYER SUR ENTRER POUR COMMENCER'''
while menuStartOn:
screen.blit(pygame.image.load("images/menu/menu_start_game/background_start_menu.jpeg"),(0,10))
pygame.display.flip()
for event in pygame.event.get():
if event.type == pygame.QUIT: sys.exit()
elif event.type == pygame.KEYDOWN:
if event.key == pygame.K_RETURN:
menuStartOn=False
elif event.key == pygame.K_ESCAPE:
self.music.stop()
self.musicAfterRecord.stop()
ecranAccueil = Menu.Menu("images/menu/menu.jpg", self.player)
ecranAccueil.addButton(Bouton.BoutonStartGame("images/menu/menu_principal/titles/play.png",0, 270, self.player, True))
ecranAccueil.addButton(Bouton.BoutonOption("images/menu/menu_principal/titles/option.png",0, 340, self.player))
ecranAccueil.addButton(Bouton.BoutonCredits("images/menu/menu_principal/titles/credits.png",0, 415))
ecranAccueil.addButton(Bouton.BoutonQuit("images/menu/menu_principal/titles/quit.png",0, 485))
ecranAccueil.afficher()
''' COMMANDES CLAVIER '''
for event in pygame.event.get():
if event.type == pygame.QUIT: sys.exit()
##### APPUI SUR TOUCHE #####
elif event.type == pygame.KEYDOWN:
# HAUT
if event.key == pygame.K_UP:
if not monVaisseau.monte:
monVaisseau.monte=True
if self.player.soundOn:
monVaisseau.son.play(-1)
# ESPACE
elif event.key == pygame.K_SPACE:
if not monVaisseau.inCharge:
monVaisseau.inCharge=True
# RIGHT
elif event.key == pygame.K_RIGHT:
if not monVaisseau.inBoost:
monVaisseau.inBoost=True
# LEFT
elif event.key == pygame.K_LEFT:
if not monVaisseau.inBreak:
monVaisseau.inBreak=True
# ECHAPE
elif event.key == pygame.K_ESCAPE:
#.........这里部分代码省略.........