def title(self): print "TITLE SCREEN" #set up game title self.imperial_music = pygame.mixer.Sound("media/audio/imperialMarch.wav") #loop to wait for clicks #while title running variable #variable to keep track of when title options should be running while self.titleRunning: #self.imperial_music.play() for event in pygame.event.get(): if event.type == QUIT: #if user clicks red x in corner, exit pygame.quit() sys.exit() elif event.type == KEYDOWN: if event.key == K_ESCAPE: pygame.quit() sys.exit() elif event.type == MOUSEBUTTONDOWN: if pygame.mouse.get_pressed()[0]: #if left mouse button is clicked mouse_x, mouse_y = pygame.mouse.get_pos() #if event.button == 1: should do same thing #if mouse pos is in single player box, get ship selection ready if self.player1pos.collidepoint(mouse_x, mouse_y): print "First option pressed" self.gs.screen.fill(self.gs.black) #self.imperial_music.stop() selection_screen = ShipSelect(self.gs) selection_screen.ship_select() #make second 2 options disappear, show ship options as new buttons #if mouse pos is in multiplayer box, wait for connection (?) if self.player2pos.collidepoint(mouse_x, mouse_y): self.connections = not self.connections self.gs.screen.fill(self.gs.black) #Add networking elements here #if mouse pos is in instructions box, open instructions page if self.instpos.collidepoint(mouse_x, mouse_y): #bring up a new instructions screen print "instructions options pressed" self.gs.screen.fill(self.gs.black) instruction_screen = Instructions(self.gs) instruction_screen.readInstructions() #self.titleRunning = False if self.hostPos.collidepoint(mouse_x, mouse_y) and self.connections: selection_screen = ShipSelect(self.gs) selection_screen.ship_select() self.gs.HOST = 1 elif self.joinPos.collidepoint(mouse_x, mouse_y) and self.connections: print "NOT HOST" self.gs.HOST = 2 self.titleRunning = False self.gs.screen.fill(self.gs.black) self.gs.screen.blit(self.titleText, self.titlepos) if not self.connections: self.gs.screen.blit(self.player1Text, self.player1pos) self.gs.screen.blit(self.player2Text, self.player2pos) self.gs.screen.blit(self.instructionText, self.instpos) else: self.gs.screen.blit(self.hostText, self.hostPos) self.gs.screen.blit(self.joinText, self.joinPos) pygame.display.flip()