def checkMeat(self): print self.meat%10 if self.meat%10 == 0: SpawnSprites.spawnGrowthBarFill(GrowthBarFillGUI.GrowthBarFillGUI,self.meat) elif self.meat%10 == 1: self.loadImages() self.image = self.growthFillImages1 self.rect = self.image.get_rect() SpawnSprites.spawnGrowthBarFill(GrowthBarFillGUI.GrowthBarFillGUI, self.meat) elif self.meat%10 == 9: self.loadImages() self.image = self.growthFillImages3 self.rect = self.image.get_rect() SpawnSprites.spawnGrowthBarFill(GrowthBarFillGUI.GrowthBarFillGUI, self.meat) else: self.loadImages() self.image = self.growthFillImages2 self.rect = self.image.get_rect() SpawnSprites.spawnGrowthBarFill(GrowthBarFillGUI.GrowthBarFillGUI, self.meat)
def checkMeat(self): print self.meat % 10 if self.meat % 10 == 0: SpawnSprites.spawnGrowthBarFill(GrowthBarFillGUI.GrowthBarFillGUI, self.meat) elif self.meat % 10 == 1: self.loadImages() self.image = self.growthFillImages1 self.rect = self.image.get_rect() SpawnSprites.spawnGrowthBarFill(GrowthBarFillGUI.GrowthBarFillGUI, self.meat) elif self.meat % 10 == 9: self.loadImages() self.image = self.growthFillImages3 self.rect = self.image.get_rect() SpawnSprites.spawnGrowthBarFill(GrowthBarFillGUI.GrowthBarFillGUI, self.meat) else: self.loadImages() self.image = self.growthFillImages2 self.rect = self.image.get_rect() SpawnSprites.spawnGrowthBarFill(GrowthBarFillGUI.GrowthBarFillGUI, self.meat)
def wave3(): SpawnSprites.spawnEnemy(SpearKnight.SpearKnight, 7, 2) SpawnSprites.spawnEnemy(SpearKnight.SpearKnight, 3, 4) SpawnSprites.spawnItem(SmallMeat.SmallMeat, 1) SpawnSprites.spawnItem(LargeMeat.LargeMeat, 3) SpawnSprites.spawnItem(ExtraLife.ExtraLife, 1) SpawnSprites.spawnEnvironment( Trees.Trees, random.randint(1, 3), random.randrange(0, Globals.screen.get_height() - 10, 25), random.randrange(0, Globals.screen.get_height() - 10, 25)) SpawnSprites.spawnEnvironment( Trees.Trees, random.randint(1, 3), random.randrange(0, Globals.screen.get_height() - 10, 25), random.randrange(0, Globals.screen.get_height() - 10, 25)) SpawnSprites.spawnEnvironment( Trees.Trees, random.randint(1, 3), random.randrange(0, Globals.screen.get_height() - 10, 25), random.randrange(0, Globals.screen.get_height() - 10, 25)) SpawnSprites.spawnEnvironment( Trees.Trees, random.randint(1, 3), random.randrange(0, Globals.screen.get_height() - 10, 25), random.randrange(0, Globals.screen.get_height() - 10, 25)) SpawnSprites.spawnEnvironment( Trees.Trees, random.randint(1, 3), random.randrange(0, Globals.screen.get_height() - 10, 25), random.randrange(0, Globals.screen.get_height() - 10, 25)) SpawnSprites.spawnEnvironment( Trees.Trees, random.randint(1, 3), random.randrange(0, Globals.screen.get_height() - 10, 25), random.randrange(0, Globals.screen.get_height() - 10, 25)) SpawnSprites.spawnEnvironment( Boulders.Boulders, random.randint(1, 3), random.randrange(0, Globals.screen.get_height() - 10, 25), random.randrange(0, Globals.screen.get_height() - 10, 25)) SpawnSprites.spawnEnvironment( Boulders.Boulders, random.randint(1, 3), random.randrange(0, Globals.screen.get_height() - 10, 25), random.randrange(0, Globals.screen.get_height() - 10, 25)) SpawnSprites.spawnEnvironment( Boulders.Boulders, random.randint(1, 3), random.randrange(0, Globals.screen.get_height() - 10, 25), random.randrange(0, Globals.screen.get_height() - 10, 25)) SpawnSprites.spawnEnvironment( Boulders.Boulders, random.randint(1, 3), random.randrange(0, Globals.screen.get_height() - 10, 25), random.randrange(0, Globals.screen.get_height() - 10, 25))
def wave1(): #SpawnSprites.spawnEnemy(SpearKnight.SpearKnight,5, 2) SpawnSprites.spawnEnemy(AxeKnight.AxeKnight, 5, 2) SpawnSprites.spawnItem(FlameCone.FlameCone3, 1) SpawnSprites.spawnItem(FlameCone.FlameCone5, 1) #SpawnSprites.spawnItem(SmallMeat.SmallMeat, 3) SpawnSprites.spawnEnvironment( Trees.Trees, random.randint(1, 3), random.randrange(0, Globals.screen.get_height(), 25), random.randrange(0, Globals.screen.get_height() - 10, 25)) SpawnSprites.spawnEnvironment( Trees.Trees, random.randint(1, 3), random.randrange(0, Globals.screen.get_height(), 25), random.randrange(0, Globals.screen.get_height() - 10, 25)) SpawnSprites.spawnEnvironment( Trees.Trees, random.randint(1, 3), random.randrange(0, Globals.screen.get_height(), 25), random.randrange(0, Globals.screen.get_height() - 10, 25))
def wave7(): SpawnSprites.spawnEnemy(SpearKnight.SpearKnight, 10, 4) SpawnSprites.spawnEnemy(SpearKnight.SpearKnight, 2, 8) SpawnSprites.spawnItem(SmallMeat.SmallMeat, 3) SpawnSprites.spawnItem(LargeMeat.LargeMeat, 10) SpawnSprites.spawnEnvironment( Trees.Trees, random.randint(1, 3), random.randrange(0, Globals.screen.get_height() - 10, 25), random.randrange(0, Globals.screen.get_height() - 10, 25)) SpawnSprites.spawnEnvironment( Trees.Trees, random.randint(1, 3), random.randrange(0, Globals.screen.get_height() - 10, 25), random.randrange(0, Globals.screen.get_height() - 10, 25)) SpawnSprites.spawnEnvironment( Trees.Trees, random.randint(1, 3), random.randrange(0, Globals.screen.get_height() - 10, 25), random.randrange(0, Globals.screen.get_height() - 10, 25)) SpawnSprites.spawnEnvironment( Trees.Trees, random.randint(1, 3), random.randrange(0, Globals.screen.get_height() - 10, 25), random.randrange(0, Globals.screen.get_height() - 10, 25)) SpawnSprites.spawnEnvironment( Trees.Trees, random.randint(1, 3), random.randrange(0, Globals.screen.get_height() - 10, 25), random.randrange(0, Globals.screen.get_height() - 10, 25)) SpawnSprites.spawnEnvironment( Trees.Trees, random.randint(1, 3), random.randrange(0, Globals.screen.get_height() - 10, 25), random.randrange(0, Globals.screen.get_height() - 10, 25))
def wave5(): SpawnSprites.spawnEnemy(SpearKnight.SpearKnight,15,4) SpawnSprites.spawnItem(SmallMeat.SmallMeat, 5) SpawnSprites.spawnItem(LargeMeat.LargeMeat, 5) SpawnSprites.spawnItem(ExtraLife.ExtraLife, 1) SpawnSprites.spawnEnvironment(Trees.Trees, random.randint(1,3), random.randrange(0,Globals.screen.get_height()-10, 25), random.randrange(0,Globals.screen.get_height()-10, 25)) SpawnSprites.spawnEnvironment(Trees.Trees, random.randint(1,3), random.randrange(0,Globals.screen.get_height()-10, 25), random.randrange(0,Globals.screen.get_height()-10, 25)) SpawnSprites.spawnEnvironment(Trees.Trees, random.randint(1,3), random.randrange(0,Globals.screen.get_height()-10, 25), random.randrange(0,Globals.screen.get_height()-10, 25)) SpawnSprites.spawnEnvironment(Trees.Trees, random.randint(1,3), random.randrange(0,Globals.screen.get_height()-10, 25), random.randrange(0,Globals.screen.get_height()-10, 25)) SpawnSprites.spawnEnvironment(Trees.Trees, random.randint(1,3), random.randrange(0,Globals.screen.get_height()-10, 25), random.randrange(0,Globals.screen.get_height()-10, 25)) SpawnSprites.spawnEnvironment(Trees.Trees, random.randint(1,3), random.randrange(0,Globals.screen.get_height()-10, 25), random.randrange(0,Globals.screen.get_height()-10, 25)) SpawnSprites.spawnEnvironment(Boulders.Boulders, random.randint(1,3), random.randrange(0,Globals.screen.get_height()-10, 25), random.randrange(0,Globals.screen.get_height()-10, 25)) SpawnSprites.spawnEnvironment(Boulders.Boulders, random.randint(1,3), random.randrange(0,Globals.screen.get_height()-10, 25), random.randrange(0,Globals.screen.get_height()-10, 25)) SpawnSprites.spawnEnvironment(Boulders.Boulders, random.randint(1,3), random.randrange(0,Globals.screen.get_height()-10, 25), random.randrange(0,Globals.screen.get_height()-10, 25))
def wave4(): SpawnSprites.spawnEnemy(SpearKnight.SpearKnight,10,2) SpawnSprites.spawnEnemy(SpearKnight.SpearKnight,5,4) SpawnSprites.spawnItem(SmallMeat.SmallMeat, 2) SpawnSprites.spawnItem(LargeMeat.LargeMeat, 4) SpawnSprites.spawnEnvironment(Trees.Trees, random.randint(1,3), random.randrange(0,Globals.screen.get_height()-10, 25), random.randrange(0,Globals.screen.get_height()-10, 25)) SpawnSprites.spawnEnvironment(Trees.Trees, random.randint(1,3), random.randrange(0,Globals.screen.get_height()-10, 25), random.randrange(0,Globals.screen.get_height()-10, 25)) SpawnSprites.spawnEnvironment(Trees.Trees, random.randint(1,3), random.randrange(0,Globals.screen.get_height()-10, 25), random.randrange(0,Globals.screen.get_height()-10, 25)) SpawnSprites.spawnEnvironment(Trees.Trees, random.randint(1,3), random.randrange(0,Globals.screen.get_height()-10, 25), random.randrange(0,Globals.screen.get_height()-10, 25)) SpawnSprites.spawnEnvironment(Trees.Trees, random.randint(1,3), random.randrange(0,Globals.screen.get_height()-10, 25), random.randrange(0,Globals.screen.get_height()-10, 25)) SpawnSprites.spawnEnvironment(Trees.Trees, random.randint(1,3), random.randrange(0,Globals.screen.get_height()-10, 25), random.randrange(0,Globals.screen.get_height()-10, 25))
def wave1(): #SpawnSprites.spawnEnemy(SpearKnight.SpearKnight,5, 2) SpawnSprites.spawnEnemy(AxeKnight.AxeKnight, 5, 2) SpawnSprites.spawnItem(FlameCone.FlameCone3, 1) SpawnSprites.spawnItem(FlameCone.FlameCone5, 1) #SpawnSprites.spawnItem(SmallMeat.SmallMeat, 3) SpawnSprites.spawnEnvironment(Trees.Trees, random.randint(1,3), random.randrange(0,Globals.screen.get_height(), 25), random.randrange(0,Globals.screen.get_height()-10, 25)) SpawnSprites.spawnEnvironment(Trees.Trees, random.randint(1,3), random.randrange(0,Globals.screen.get_height(), 25), random.randrange(0,Globals.screen.get_height()-10, 25)) SpawnSprites.spawnEnvironment(Trees.Trees, random.randint(1,3), random.randrange(0,Globals.screen.get_height(), 25), random.randrange(0,Globals.screen.get_height()-10, 25))
def game(): if Globals.clearSprites == True: Globals.environment.empty() Globals.powerups.empty() Globals.fireballs.empty() Globals.enemySprites.empty() Globals.gameGUI.empty() pygame.display.set_caption( "Knight Hunter - Defend against the vicious knights") Globals.screen.blit(Globals.background, (0, 0)) field = Field.Field() dragon = Dragon.Dragon() growthBarOutline = ScoreboardGUI.GrowthBarGUI() scoreboard = ScoreboardGUI.ScoreboardGUI() fieldSprite = pygame.sprite.Group(field) friendlySprites = pygame.sprite.Group(dragon) scoreSprites = pygame.sprite.Group(scoreboard, growthBarOutline) if Globals.resume == False: Globals.score = 0 Waves.spawnWave(Globals.currentWave) # SpawnSprites.spawnGrowthBarFill(Globals.meat) Globals.clearSprites = False clock = pygame.time.Clock() keepGoing = True while keepGoing: clock.tick(30) pygame.mouse.set_visible(False) for event in pygame.event.get(): #clearing sprites without leaving the game() function #if Globals.clearSprites == True: #Globals.environment.empty() #Globals.powerups.empty() #Globals.fireballs.empty() #Globals.enemySprites.empty() #Globals.gameGUI.empty() print Globals.growthBar print len(Globals.growthBar) print Globals.growthBarFill if scoreboard.lives <= -1: Globals.gameOver = True Globals.resume = False Globals.clearSprites = True Globals.mainGame = False keepGoing = False if event.type == pygame.QUIT: Globals.donePlaying = True keepGoing = False elif event.type == pygame.KEYDOWN: keyName = pygame.key.name(event.key) if event.key == pygame.K_ESCAPE: Globals.donePlaying = True keepGoing = False if event.key == pygame.K_p: keepGoing = False Globals.pauseMenu = True Globals.mainGame = False Globals.resume = True Globals.clearSprites = False hitEnvironment = pygame.sprite.spritecollide(dragon, Globals.environment, False) for theEnvironment in hitEnvironment: if theEnvironment.type == Globals.environmentTree: dragon.state = dragon.STANDING dragon.dx = 0 dragon.dy = 0 elif theEnvironment.type == Globals.environmentBoulder: dragon.dx = 0 dragon.dy = 0 hitPowerUp = pygame.sprite.spritecollide(dragon, Globals.powerups, True) for powerUps in hitPowerUp: print powerUps.type if powerUps.type == Globals.powerUpSmallMeat: print Globals.growth #dragon.sndEat.play() Globals.score += 500 Globals.meat += 1 #SpawnSprites.spawnGrowthBarFill(Globals.meat) if Globals.meat >= 30: Globals.meat = 30 scoreboard.score = Globals.score elif powerUps.type == Globals.powerUpLargeMeat: print Globals.growth #dragon.sndEat.play() Globals.score += 1250 Globals.meat += 2 if Globals.meat >= 30: Globals.meat = 30 scoreboard.score = Globals.score elif powerUps.type == Globals.powerUpExtraLife: #dragon.sndExtraLife.play() Globals.score += 75 Globals.lives += 1 scoreboard.lives = Globals.lives scoreboard.score = Globals.score elif powerUps.type == Globals.powerUpFlameCone3: # this will give score, destroy the sprite, and start counting # down the timer for the flame cone Globals.score += 150 dragon.powerupactive = dragon.FLAMECONE3 elif powerUps.type == Globals.powerUpFlameCone5: # this will give score, destroy the sprite, and start counting # down the timer for the flame cone Globals.score += 350 dragon.powerupactive = dragon.FLAMECONE5 else: print "got a power up type I don't understand" bounceEnemies = pygame.sprite.groupcollide(Globals.environment, Globals.enemySprites, False, False) if bounceEnemies: for theEnemyBounce in bounceEnemies: if theEnemyBounce.type == Globals.enemySpearKnight: theEnemyBounce.dx *= -1 theEnemyBounce.dy *= -1 hitEnemies = pygame.sprite.spritecollide(dragon, Globals.enemySprites, True) if hitEnemies: for theEnemyHit in hitEnemies: if theEnemyHit.type == Globals.enemySpearKnight: SpawnSprites.spawnEnemy(SpearKnight.SpearKnight, 1, 2) #elif theEnemyHit == SpearKnightMedium: #SpawnSprites.spawnEnemy(SpearKnight.SpearKnight, 1, 4, SpawnSprites) #elif theEnemyHit == SpearKnightFast: #SpawnSprites.spawnEnemy(SpearKnight.SpearKnight, 1, 8, SpawnSprites) else: print theEnemyHit print theEnemyHit.type print "enemy spawn error" Globals.lives -= 1 Globals.meat /= 2 scoreboard.lives = Globals.lives dragon.reset() for fireball in Globals.fireballs: burnEnemies = pygame.sprite.spritecollide(fireball, Globals.enemySprites, True) if burnEnemies: for enemyBurned in burnEnemies: Globals.score += 3000 scoreboard.score = Globals.score #fireball.sndKill.play() fireball.kill() SpawnSprites.spawnIten(SmallMeat.SmallMeat, 1, enemyBurned.x, enemyBurned.y) #SpawnSprites.spawnItem(SmallMeat.SmallMeat, 1, enemyBurned.x, enemyBurned.y) for fireball in Globals.fireballs: burnEnvironment = pygame.sprite.spritecollide( fireball, Globals.environment, False) for theEnvironment in burnEnvironment: if theEnvironment.type == Globals.environmentTree: theEnvironment.kill() Globals.score += 50 scoreboard.score = Globals.score #fireball.sndKill.play() fireball.kill() elif theEnvironment.type == Globals.environmentBoulder: fireball.kill() if len(Globals.enemySprites) == 0: if Globals.currentWave > 10: Globals.winScreen = True Globals.resume = False Globals.clearSprites = True Globals.mainGame = False keepGoing = False else: Globals.currentWave += 1 dragon.reset() Globals.clearSprites = True Globals.resume = True Waves.spawnWave(Globals.currentWave) SpawnSprites.spawnGrowthBarFill(ScoreboardGUI.GrowthBarFillGUI, Globals.meat) fieldSprite.update() Globals.fireballs.update() Globals.environment.update() Globals.enemySprites.update() Globals.gameGUI.update() friendlySprites.update() scoreSprites.update() fieldSprite.draw(Globals.screen) Globals.fireballs.draw(Globals.screen) Globals.powerups.draw(Globals.screen) Globals.environment.draw(Globals.screen) Globals.enemySprites.draw(Globals.screen) friendlySprites.draw(Globals.screen) Globals.gameGUI.draw(Globals.screen) scoreSprites.draw(Globals.screen) Globals.powerups.update() pygame.display.flip() pygame.mouse.set_visible(True)
def game(): if Globals.clearSprites == True: Globals.environment.empty() Globals.powerups.empty() Globals.fireballs.empty() Globals.enemySprites.empty() Globals.gameGUI.empty() pygame.display.set_caption("Knight Hunter - Defend against the vicious knights") Globals.screen.blit(Globals.background, (0, 0)) field = Field.Field() dragon = Dragon.Dragon() growthBarOutline = ScoreboardGUI.GrowthBarGUI() scoreboard = ScoreboardGUI.ScoreboardGUI() fieldSprite = pygame.sprite.Group(field) friendlySprites = pygame.sprite.Group(dragon) scoreSprites = pygame.sprite.Group(scoreboard, growthBarOutline) if Globals.resume == False: Globals.score = 0 Waves.spawnWave(Globals.currentWave) # SpawnSprites.spawnGrowthBarFill(Globals.meat) Globals.clearSprites = False clock = pygame.time.Clock() keepGoing = True while keepGoing: clock.tick(30) pygame.mouse.set_visible(False) for event in pygame.event.get(): #clearing sprites without leaving the game() function #if Globals.clearSprites == True: #Globals.environment.empty() #Globals.powerups.empty() #Globals.fireballs.empty() #Globals.enemySprites.empty() #Globals.gameGUI.empty() print Globals.growthBar print len(Globals.growthBar) print Globals.growthBarFill if scoreboard.lives <= -1: Globals.gameOver = True Globals.resume = False Globals.clearSprites = True Globals.mainGame = False keepGoing = False if event.type == pygame.QUIT: Globals.donePlaying = True keepGoing = False elif event.type == pygame.KEYDOWN: keyName = pygame.key.name(event.key) if event.key == pygame.K_ESCAPE: Globals.donePlaying = True keepGoing = False if event.key == pygame.K_p: keepGoing = False Globals.pauseMenu = True Globals.mainGame = False Globals.resume = True Globals.clearSprites = False hitEnvironment = pygame.sprite.spritecollide(dragon, Globals.environment, False) for theEnvironment in hitEnvironment: if theEnvironment.type == Globals.environmentTree: dragon.state = dragon.STANDING dragon.dx = 0 dragon.dy = 0 elif theEnvironment.type == Globals.environmentBoulder: dragon.dx = 0 dragon.dy = 0 hitPowerUp = pygame.sprite.spritecollide(dragon, Globals.powerups, True) for powerUps in hitPowerUp: print powerUps.type if powerUps.type == Globals.powerUpSmallMeat: print Globals.growth #dragon.sndEat.play() Globals.score += 500 Globals.meat += 1 #SpawnSprites.spawnGrowthBarFill(Globals.meat) if Globals.meat >= 30: Globals.meat = 30 scoreboard.score = Globals.score elif powerUps.type == Globals.powerUpLargeMeat: print Globals.growth #dragon.sndEat.play() Globals.score += 1250 Globals.meat += 2 if Globals.meat >= 30: Globals.meat = 30 scoreboard.score = Globals.score elif powerUps.type == Globals.powerUpExtraLife: #dragon.sndExtraLife.play() Globals.score += 75 Globals.lives += 1 scoreboard.lives = Globals.lives scoreboard.score = Globals.score elif powerUps.type == Globals.powerUpFlameCone3: # this will give score, destroy the sprite, and start counting # down the timer for the flame cone Globals.score += 150 dragon.powerupactive = dragon.FLAMECONE3 elif powerUps.type == Globals.powerUpFlameCone5: # this will give score, destroy the sprite, and start counting # down the timer for the flame cone Globals.score += 350 dragon.powerupactive = dragon.FLAMECONE5 else: print "got a power up type I don't understand" bounceEnemies = pygame.sprite.groupcollide(Globals.environment, Globals.enemySprites, False, False) if bounceEnemies: for theEnemyBounce in bounceEnemies: if theEnemyBounce.type == Globals.enemySpearKnight: theEnemyBounce.dx *= -1 theEnemyBounce.dy *= -1 hitEnemies = pygame.sprite.spritecollide(dragon, Globals.enemySprites, True) if hitEnemies: for theEnemyHit in hitEnemies: if theEnemyHit.type == Globals.enemySpearKnight: SpawnSprites.spawnEnemy(SpearKnight.SpearKnight, 1, 2) #elif theEnemyHit == SpearKnightMedium: #SpawnSprites.spawnEnemy(SpearKnight.SpearKnight, 1, 4, SpawnSprites) #elif theEnemyHit == SpearKnightFast: #SpawnSprites.spawnEnemy(SpearKnight.SpearKnight, 1, 8, SpawnSprites) else: print theEnemyHit print theEnemyHit.type print "enemy spawn error" Globals.lives -= 1 Globals.meat /= 2 scoreboard.lives = Globals.lives dragon.reset() for fireball in Globals.fireballs: burnEnemies = pygame.sprite.spritecollide(fireball, Globals.enemySprites, True) if burnEnemies: for enemyBurned in burnEnemies: Globals.score += 3000 scoreboard.score = Globals.score #fireball.sndKill.play() fireball.kill() SpawnSprites.spawnIten(SmallMeat.SmallMeat, 1, enemyBurned.x, enemyBurned.y) #SpawnSprites.spawnItem(SmallMeat.SmallMeat, 1, enemyBurned.x, enemyBurned.y) for fireball in Globals.fireballs: burnEnvironment = pygame.sprite.spritecollide(fireball, Globals.environment, False) for theEnvironment in burnEnvironment: if theEnvironment.type == Globals.environmentTree: theEnvironment.kill() Globals.score += 50 scoreboard.score = Globals.score #fireball.sndKill.play() fireball.kill() elif theEnvironment.type == Globals.environmentBoulder: fireball.kill() if len(Globals.enemySprites) == 0: if Globals.currentWave > 10: Globals.winScreen = True Globals.resume = False Globals.clearSprites = True Globals.mainGame = False keepGoing = False else: Globals.currentWave += 1 dragon.reset() Globals.clearSprites = True Globals.resume = True Waves.spawnWave(Globals.currentWave) SpawnSprites.spawnGrowthBarFill(ScoreboardGUI.GrowthBarFillGUI, Globals.meat) fieldSprite.update() Globals.fireballs.update() Globals.environment.update() Globals.enemySprites.update() Globals.gameGUI.update() friendlySprites.update() scoreSprites.update() fieldSprite.draw(Globals.screen) Globals.fireballs.draw(Globals.screen) Globals.powerups.draw(Globals.screen) Globals.environment.draw(Globals.screen) Globals.enemySprites.draw(Globals.screen) friendlySprites.draw(Globals.screen) Globals.gameGUI.draw(Globals.screen) scoreSprites.draw(Globals.screen) Globals.powerups.update() pygame.display.flip() pygame.mouse.set_visible(True)
def dragonFire(self): if self.firedelay%10 == 0: #self.sndFireball.play() if self.powerupactive == self.NORMAL: SpawnSprites.fire(Globals.dragonCenterX, Globals.dragonCenterY, Globals.dragonDirection) if self.powerupactive == self.FLAMECONE3: tempDir1 = Globals.dragonDirection + 30 tempDir2 = Globals.dragonDirection - 30 SpawnSprites.fire(Globals.dragonCenterX, Globals.dragonCenterY, Globals.dragonDirection) SpawnSprites.fire(Globals.dragonCenterX, Globals.dragonCenterY, tempDir1) SpawnSprites.fire(Globals.dragonCenterX, Globals.dragonCenterY, tempDir2) print tempDir1 if self.powerupactive == self.FLAMECONE5: tempDir1 = Globals.dragonDirection + 45 tempDir2 = Globals.dragonDirection + 30 tempDir3 = Globals.dragonDirection + 15 tempDir4 = Globals.dragonDirection - 15 tempDir5 = Globals.dragonDirection - 30 tempDir6 = Globals.dragonDirection - 45 SpawnSprites.fire(Globals.dragonCenterX, Globals.dragonCenterY, Globals.dragonDirection) SpawnSprites.fire(Globals.dragonCenterX, Globals.dragonCenterY, tempDir1) SpawnSprites.fire(Globals.dragonCenterX, Globals.dragonCenterY, tempDir2) SpawnSprites.fire(Globals.dragonCenterX, Globals.dragonCenterY, tempDir3) SpawnSprites.fire(Globals.dragonCenterX, Globals.dragonCenterY, tempDir4) SpawnSprites.fire(Globals.dragonCenterX, Globals.dragonCenterY, tempDir5) SpawnSprites.fire(Globals.dragonCenterX, Globals.dragonCenterY, tempDir6) print tempDir1 print tempDir2 print tempDir3 print tempDir4 print tempDir5 print tempDir6 self.firedelay += 1 else: self.firedelay += 1