def initial_Spawn(self): if constants.activeMode == 0 or constants.activeMode == 1: color = colors.BLACK goodBlock.spawnGoodBlock(self.goodBlockNumber,constants.player.rect.x, constants.player.rect.y, player.playerWidth, player.playerHeight) triangleUpDown.spawnTriangleUD(self.triangleNumber,constants.player.rect.x, constants.player.rect.y, player.playerWidth, player.playerHeight,triangle.triangleSpeed,color) badBlock.spawnBadBlock(self.badBlockNumber,constants.player.rect.x, constants.player.rect.y, player.playerWidth, player.playerHeight,color) fourSquare.spawnFourSquare(self.fourSquareNumber,constants.player.rect.x, constants.player.rect.y, player.playerWidth, player.playerHeight,color) fatties.spawnFatty(self.fattyNumber,constants.player.rect.x, constants.player.rect.y, player.playerWidth, player.playerHeight,color) circle.spawnCircle(self.circleNumber,constants.player.rect.x, constants.player.rect.y, player.playerWidth, player.playerHeight,color) straffer.spawnStraffer(self.strafferNumber,constants.player.rect.x, constants.player.rect.y, player.playerWidth, player.playerHeight,color) fastCircle.spawnfastCircle(self.fastCircles,constants.player.rect.x, constants.player.rect.y, player.playerWidth, player.playerHeight,color) hunterStraffer.spawnHunterStraffer(self.hunterStrafferNumber,constants.player.rect.x, constants.player.rect.y, player.playerWidth, player.playerHeight,color) #bottomUpCountDown.spawnbottomUpCountDown(colors.SOFT_RED) #bottomUpHaz.spawnBottomUpHaz(colors.SOFT_RED) else: color = colors.BLUE goodBlock.spawnGoodBlock(self.goodBlockNumber,constants.player.rect.x, constants.player.rect.y, player.playerWidth, player.playerHeight) triangle.spawnTriangle(self.triangleNumber,constants.player.rect.x, constants.player.rect.y, player.playerWidth, player.playerHeight,triangle.triangleSpeed,colors.BLUE) badBlock.spawnBadBlock(self.badBlockNumber,constants.player.rect.x, constants.player.rect.y, player.playerWidth, player.playerHeight,colors.RED) fourSquare.spawnFourSquare(self.fourSquareNumber,constants.player.rect.x, constants.player.rect.y, player.playerWidth, player.playerHeight,colors.BLUE) fatties.spawnFatty(self.fattyNumber,constants.player.rect.x, constants.player.rect.y, player.playerWidth, player.playerHeight,colors.RED) circle.spawnCircle(self.circleNumber,constants.player.rect.x, constants.player.rect.y, player.playerWidth, player.playerHeight,colors.RED) straffer.spawnStraffer(self.strafferNumber,constants.player.rect.x, constants.player.rect.y, player.playerWidth, player.playerHeight,colors.BLUE) fastCircle.spawnfastCircle(self.fastCircles,constants.player.rect.x, constants.player.rect.y, player.playerWidth, player.playerHeight,colors.RED) hunterStraffer.spawnHunterStraffer(self.hunterStrafferNumber,constants.player.rect.x, constants.player.rect.y, player.playerWidth, player.playerHeight,colors.RED)
def spawn_enemies(self): if pygame.time.get_ticks()/1000 > constants.logicOffSet: if (pygame.time.get_ticks()-constants.lastEndTime-constants.pauseTimeSinceStart)/1000 == 20: constants.minEnemyCount = 8 elif (pygame.time.get_ticks()-constants.lastEndTime-constants.pauseTimeSinceStart)/1000 == 40: constants.minEnemyCount = 11 elif (pygame.time.get_ticks()-constants.lastEndTime-constants.pauseTimeSinceStart)/1000 == 60: constants.minEnemyCount = 15 elif (pygame.time.get_ticks()-constants.lastEndTime-constants.pauseTimeSinceStart)/1000 == 80: constants.minEnemyCount = 20 constants.logicOffSet = pygame.time.get_ticks()/1000 #(constants.pauseTimeSinceStart-constants.lastEndTime) deltaSeconds = ((pygame.time.get_ticks()-constants.lastEndTime-constants.pauseTimeSinceStart)-constants.lastSpawnTime)/1000 if constants.activeMode == 0 or constants.activeMode == 2: deltaSeconds = deltaSeconds/1.5 if deltaSeconds >= constants.timeTillSpawn or len(Lists.Enemy_list) + len(Lists.Blue_Enemy_list) + len(Lists.Red_Enemy_list) < constants.minEnemyCount : constants.timeTillSpawn = constants.secondsTillNextSpawnList[random.randrange(0,len(constants.secondsTillNextSpawnList))] scoreRate = constants.score - constants.scoreForSpawnRate spawnValue = random.random() constants.spawnCounter = 10 + scoreRate/constants.scoreRateAdjuster currEnemyCount = len(Lists.Enemy_list) while constants.spawnCounter + currEnemyCount > constants.maxEnemyCount: constants.spawnCounter = constants.spawnCounter/2 constants.lastSpawnTime = pygame.time.get_ticks() - constants.lastEndTime - constants.pauseTimeSinceStart constants.count = 0 if constants.activeMode == 0 or constants.activeMode == 2: constants.spawnCounter = constants.spawnCounter/1.5 #spawn a random number of enemies if constants.count < constants.spawnCounter: spawnValue = random.random() if constants.activeMode == 2: colorValue = random.random() if colorValue > 0.5: color = colors.RED else: color = colors.BLUE else: color = colors.BLACK if (self.gameTime-constants.pauseTimeSinceStart-constants.lastEndTime)/1000 < 60: if spawnValue < 0.15: triangle.spawnTriangle(1,constants.player.rect.x, constants.player.rect.y, player.playerWidth, player.playerHeight,5,color) if spawnValue < 0.30: triangleUpDown.spawnTriangleUD(1,constants.player.rect.x, constants.player.rect.y, player.playerWidth, player.playerHeight,5,color) elif spawnValue < 0.45: badBlock.spawnBadBlock(1,constants.player.rect.x, constants.player.rect.y, player.playerWidth, player.playerHeight,color) elif spawnValue < 0.55: if len(Lists.fourSquare_list) <3 and (pygame.time.get_ticks() - constants.timeSinceLastFourSquareSpawn)/1000 > 10: fourSquare.spawnFourSquare(1,constants.player.rect.x, constants.player.rect.y, player.playerWidth, player.playerHeight,color) constants.timeSinceLastFourSquareSpawn = pygame.time.get_ticks() else: constants.count -= 1 elif spawnValue < 0.60: if len(Lists.fatty_list) <3 and (pygame.time.get_ticks() - constants.timeSinceLastFattySpawn)/1000 > 10: fatties.spawnFatty(1,constants.player.rect.x, constants.player.rect.y, player.playerWidth, player.playerHeight,color) constants.timeSinceLastFattySpawn = pygame.time.get_ticks() else: constants.count -= 1 elif spawnValue < 0.70: circle.spawnCircle(1,constants.player.rect.x, constants.player.rect.y, player.playerWidth, player.playerHeight,color) elif spawnValue < 0.95 - pygame.time.get_ticks()/500000: hunterStraffer.spawnHunterStraffer(1,constants.player.rect.x, constants.player.rect.y, player.playerWidth, player.playerHeight,color) elif spawnValue < 0.975 - pygame.time.get_ticks()/500000: fastCircle.spawnfastCircle(1,constants.player.rect.x, constants.player.rect.y, player.playerWidth, player.playerHeight,color) elif spawnValue < 1: triangle.spawnTriangle(1,constants.player.rect.x, constants.player.rect.y, player.playerWidth, player.playerHeight,5,color) else: if spawnValue < 0.10: triangle.spawnTriangle(1,constants.player.rect.x, constants.player.rect.y, player.playerWidth, player.playerHeight,5,color) if spawnValue < 0.20: triangleUpDown.spawnTriangleUD(1,constants.player.rect.x, constants.player.rect.y, player.playerWidth, player.playerHeight,5,color) elif spawnValue < 0.30: badBlock.spawnBadBlock(1,constants.player.rect.x, constants.player.rect.y, player.playerWidth, player.playerHeight,color) elif spawnValue < 0.50: if len(Lists.fourSquare_list) <3 and (pygame.time.get_ticks() - constants.timeSinceLastFourSquareSpawn)/1000 > 10: fourSquare.spawnFourSquare(1,constants.player.rect.x, constants.player.rect.y, player.playerWidth, player.playerHeight,color) constants.timeSinceLastFourSquareSpawn = pygame.time.get_ticks() else: constants.count -= 1 elif spawnValue < 0.55: if len(Lists.fatty_list) <3 and (pygame.time.get_ticks() - constants.timeSinceLastFattySpawn)/1000 > 10: fatties.spawnFatty(1,constants.player.rect.x, constants.player.rect.y, player.playerWidth, player.playerHeight,color) constants.timeSinceLastFattySpawn = pygame.time.get_ticks() else: constants.count -= 1 elif spawnValue < 0.60: circle.spawnCircle(1,constants.player.rect.x, constants.player.rect.y, player.playerWidth, player.playerHeight,color) elif spawnValue < 0.80 - pygame.time.get_ticks()/500000: hunterStraffer.spawnHunterStraffer(1,constants.player.rect.x, constants.player.rect.y, player.playerWidth, player.playerHeight,color) elif spawnValue < 0.90 - pygame.time.get_ticks()/500000: fastCircle.spawnfastCircle(1,constants.player.rect.x, constants.player.rect.y, player.playerWidth, player.playerHeight,color) elif spawnValue < 1: triangle.spawnTriangle(1,constants.player.rect.x, constants.player.rect.y, player.playerWidth, player.playerHeight,5,color) constants.count += 1 constants.scoreForSpawnRate = constants.score constants.scoreRateAdjuster += 3