def nightCamp(game): while True: common_functions.standardEventHandling() cfg.DISPLAYSURF.blit(cfg.IMAGEDICT['Camp - Night'], (0, 0)) game._displayHud() optionBackSurf = pygame.Surface((240, 60)) optionBackSurf.set_alpha(140) optionBackRect = optionBackSurf.get_rect() optionBackRect.topleft = (100, 100) sleepSurf = cfg.BASICFONT.render('Sleep', True, cfg.WHITE) sleepRect = sleepSurf.get_rect() sleepRect.midleft = (optionBackRect.left + 15, optionBackRect.centery) if optionBackRect.collidepoint(cfg.mouseX, cfg.mouseY): sleepSurf = cfg.BASICFONT.render('Sleep', True, cfg.RED) optionBackSurf.fill(cfg.BLUE) optionBackSurf.set_alpha(55) if cfg.mouseClicked: common_functions.fadeout(speed=15) return cfg.DISPLAYSURF.blit(optionBackSurf, optionBackRect) pygame.draw.rect(cfg.DISPLAYSURF, cfg.WHITE, optionBackRect, 2) cfg.DISPLAYSURF.blit(sleepSurf, sleepRect) pygame.display.update() cfg.FPSCLOCK.tick(cfg.FPS)
def morningCamp(player): cfg.SOUNDDICT['Morning'].play() for i in range(255,0,-15): maskSurf = pygame.Surface((800, 600)) maskSurf.fill(cfg.BLACK) maskSurf.set_alpha(i) cfg.DISPLAYSURF.blit(cfg.IMAGEDICT['Camp - Day'], (0,0)) cfg.DISPLAYSURF.blit(maskSurf, (0,0)) pygame.display.update() cfg.FPSCLOCK.tick(cfg.FPS) while True: common_functions.standardEventHandling() cfg.DISPLAYSURF.blit(cfg.IMAGEDICT['Camp - Day'], (0,0)) player._displayHud() optionBackSurf = pygame.Surface((200, 50)) optionBackRect = optionBackSurf.get_rect() optionBackRect.bottomright = (600, 400) resumeSurf = cfg.BASICFONT.render('Resume Trip', True, cfg.WHITE) resumeRect = resumeSurf.get_rect() resumeRect.midleft = (optionBackRect.left + 15, optionBackRect.centery) if optionBackRect.collidepoint(cfg.mouseX, cfg.mouseY): resumeSurf = cfg.BASICFONT.render('Resume Trip', True, cfg.RED) if cfg.mouseClicked: common_functions.fadeout() return cfg.DISPLAYSURF.blit(optionBackSurf, optionBackRect) cfg.DISPLAYSURF.blit(resumeSurf, resumeRect) pygame.display.update() cfg.FPSCLOCK.tick(cfg.FPS)