Exemple #1
0
 def reset(self):
     if self.AI:
         self.pShip = ships.AutoPlayer(self.BGWIDTH / 2, self.BGHEIGHT / 2,
                                       64, 64, None)
     else:
         self.pShip = ships.Player(self.BGWIDTH / 2, self.BGHEIGHT / 2, 64,
                                   64)
     self.pShip.setBounds(0, 0, self.BGWIDTH - 10, self.BGHEIGHT - 10)
     self.slack = self.cameraUpdate(self.pShip)
     self.score = 0
     self.upgrading = False
     self.won = False
     self.endTime = None
     self.initWaves()
Exemple #2
0
 def __init__(self, WIN_WIDTH, WIN_HEIGHT, BGWIDTH, BGHEIGHT, AI=False):
     self.WIN_WIDTH = WIN_WIDTH
     self.WIN_HEIGHT = WIN_HEIGHT
     self.BGWIDTH = BGWIDTH
     self.BGHEIGHT = BGHEIGHT
     self.score = 0
     self.multiplier = 1.0
     self.upgrading = False
     self.won = False
     self.AI = AI
     self.endTime = None
     if self.AI:
         self.pShip = ships.AutoPlayer(BGWIDTH / 2, BGHEIGHT / 2, 64, 64,
                                       None)
     else:
         self.pShip = ships.Player(BGWIDTH / 2, BGHEIGHT / 2, 64, 64)
     self.pShip.setBounds(0, 0, BGWIDTH - 10, BGHEIGHT - 10)
     self.slack = self.cameraUpdate(self.pShip)
     self.initWaves()
Exemple #3
0
#Mouse Variables
mousePosition = (0, 0)
mouseStates = None
mouseDown = False

#Image Variables
startScreen = pygame.image.load("assets/start_screen.png")
background = pygame.image.load("assets/background.png")
loseScreen = pygame.image.load("assets/lose_screen.png")
winScreen = pygame.image.load("assets/win_screen.png")
nextWave = pygame.image.load("assets/next_level.png")
finalWave = pygame.image.load("assets/final_level.png")

#Ships
ship = ships.Player(windowWidth / 2, windowHeight, pygame, surface)
enemyShips = []

leftOverBullets = []

#Sound Setup
pygame.mixer.init()


def launchWave():

    global lastSpawn, currentWave, currentLevel, gameOver, gameWon, nextLevelTS

    thisLevel = gameLevels.level[currentLevel]["structure"]

    if currentWave < len(thisLevel):