def __init__(self, game): global HEADER, BACKGROUND self.surface = pygame.Surface(SCREEN_SIZE) self.game = game self.surface.fill(BACKGROUND) # Draw the logo self.logo, self.logoRect = GUIObjects.load_image_alpha('wiiTreeKings.png') rect = self.surface.get_rect() logoPos = ((rect.width-self.logoRect.width)/2, 120) self.surface.blit( self.logo, logoPos ) self.WEPControl = None pygame.display.flip() # Build the Buttons addButton = GUIObjects.Button((self.surface.get_rect().centerx - 250, 600), "Add Wiimotes", self.addWiimotes) exitButton = GUIObjects.Button((self.surface.get_rect().centerx, 700), "Exit", sys.exit) playButton = GUIObjects.Button((self.surface.get_rect().centerx + 250, 600), "Play the Game", self.buildTwoGame) # Make the Buttons clickable on the window and part of the allsprites for the window self.clickables = [addButton, exitButton, playButton] self.allsprites = pygame.sprite.LayeredUpdates((addButton, exitButton, playButton)) self.WEPControlpid = None
def __init__(self, x, y, playerNum): self.fileName = 'player' + str(playerNum+1) + '.png' pygame.sprite.Sprite.__init__(self) self.lightimage, self.lightrect = GUIObjects.load_image_alpha(self.fileName) self.rect = pygame.Rect(self.lightrect) self.rect.height += 75 self.image = pygame.Surface((self.rect.width, self.rect.height)) self.rect.centerx = x self.rect.centery = y self.playerNum = playerNum self.drawImage()