def draw(font, largeFont): background(0, 100, 0) functions.drawText(255, 255, 255, largeFont[1], "TypeMania", 400, 200 + largeFont[0] // 2) functions.drawText(255, 255, 255, font[1], "Press space to continue", 400, 300 + font[0] // 2)
def event_popup(self,event_list,explorer): '''get event from event manager and assign it locally''' events = event_list for event in events: self.game.pause = True event.update(explorer) '''blits popup bg ''' tooltip_bg = Data.backgrounds['event'] tooltip_bg.set_alpha(50) tooltip_rect = tooltip_bg.get_rect() fn.blitc(self.screen,tooltip_bg,(Config.screen_w/2,Config.screen_h/2)) '''blit event's img''' fn.blitc(self.screen,Data.event_images[event.name],(Config.screen_w/2,Config.screen_h/2-115)) #-50 to adjust image to pupup bg '''blit event's text''' text_zone = pygame.Rect((Config.screen_w/2-300,Config.screen_h/2+50),(tooltip_rect.w-50,300)) fn.drawText(self.screen,event.text,(0,255,0),text_zone, pygame.font.SysFont('Lucida Console', 15)) '''button actions''' okay_but = Button('Approve',event,Config.screen_w/2+15,Config.screen_h/2+210) okay_but.check_select() okay_but.display(self.screen) if okay_but.selected and self.game.pressed_left_clic: self.game.pause = False event.execute(explorer) self.game.event_manager.active_events.remove(event) self.game.map_active = True self.game.pressed_left_clic = False break #only does the function for one event at a time
def drawWords(smallFont, font, largeFont): global currentWord, currentEntry, corrects, errors functions.drawText(0, 150, 0, smallFont[1], "Type the word or press 0 to quit", 400, 25 + smallFont[0] // 2) functions.drawText(0, 150, 0, largeFont[1], currentWord, 400, 150 + largeFont[0] // 2) functions.drawText(255, 255, 255, font[1], currentEntry, 400, 350 + font[0] // 2) score = "words: %d mistakes: %d" % (corrects, errors) functions.drawText(255, 255, 255, smallFont[1], score, 400, 375 + smallFont[0] // 2)
def draw(font1): background(0) functions.drawText("Player 1, Are you Mafia or Federal Agencies?", 960, 440) fill(0, 0, 255) rect(1160, 640, 100, 100) fill(255, 0, 0) rect(660, 640, 100, 100) functions.drawText("Mafia", 710, 685) functions.drawText("FA", 1210, 685)
def mainLoop(): while not isGameOver: for event in pygame.event.get(): if event.type == pygame.KEYDOWN: if event.key == pygame.K_ESCAPE: functions.drawText(globals.backToMenuMessage, "data/fonts/RAVIE.ttf", 18, globals.RED, (100, globals.screenHeight/2))
# elif globals.gameState[1]: # Minigame 1 # Voer hier minigame 1 uit # elif globals.gameState[2]: # Minigame 2 # Voer hier minigame 2 uit # elif globals.gameState[3]: # Minigame 3 # Voer hier minigame 3 uit # elif globals.gameState[4]: # Minigame 4 # Voer hier minigame 4 uit # elif globals.gameState[5]: # Voer hier minigame 5 uit #Alles tekenen globals.screen.fill(globals.BLACK) if functions.checkIfGameStatesAreFalse(): #Startscherm functions.drawText("Dineerbeer!", "data/fonts/RAVIE.ttf", 72, globals.BLUE, (130, 200)) functions.drawText("Druk op ENTER om te beginnen", "data/fonts/RAVIE.ttf", 18, globals.GREEN, (210, 400)) functions.drawText("Druk op ESCAPE om af te sluiten", "data/fonts/RAVIE.ttf", 18, globals.RED, (200, 500)) elif globals.gameState[0]: #Menu menu.draw() # Minigame 1 tekenen # Teken hier minigame 1 # Minigame 2 tekenen # Teken hier minigame 2