def MODE_SELECT(): CLOCK = pygame.time.Clock() LOOP = True ALL_SPRITES = pygame.sprite.Group() SELECTOR_BIG = S.SELECTOR_BIG((250, 200)) ALL_SPRITES.add(SELECTOR_BIG) SELECTINT = 0 MODE_CHOICES = ['CLASSIC', 'TENSE', 'CHAOS'] TEXTS1 = G.FONTNORMAL.render('Choose your difficulty', True, G.WHITE) TEXTS2 = G.FONTNORMAL.render('Space to continue', True, G.WHITE) while LOOP: for event in pygame.event.get(): if event.type == pygame.QUIT: pygame.quit() sys.exit() # Keymap elif event.type == pygame.KEYDOWN: if event.key == pygame.K_UP: SELECTINT -= 1 SELECTOR_BIG.pos[1] -= 100 if event.key == pygame.K_DOWN: SELECTINT += 1 SELECTOR_BIG.pos[1] += 100 if event.key == pygame.K_SPACE: '''Loads values into G.MODE''' G.MODE = MODE_CHOICES[SELECTINT] D.MODE_DICT[G.MODE]['SOUND'].play() LOOP = False if event.key in (pygame.K_UP, pygame.K_DOWN): if SELECTINT == -1: SELECTINT = 2 elif SELECTINT == 3: SELECTINT = 0 D.MEDIA['select_sound'].play() ALL_SPRITES.update() # Drawing G.SCREEN.fill(G.BLACK) G.SCREEN.blit(D.MEDIA['classic_card'], (150, 150)) G.SCREEN.blit(D.MEDIA['tense_card'], (150, 250)) G.SCREEN.blit(D.MEDIA['chaos_card'], (150, 350)) ALL_SPRITES.draw(G.SCREEN) # G.SCREEN.blit(D.MEDIA['mode_select_border'], (0, 0)) G.SCREEN.blit(TEXTS1, (100, 50)) G.SCREEN.blit(TEXTS2, (125, 500)) pygame.display.flip() CLOCK.tick(60)
def MODE_SELECT(): CLOCK = pygame.time.Clock() LOOP = True ALL_SPRITES = pygame.sprite.Group() SELECTOR_BIG = s.SELECTOR_BIG((250, 250)) MODE_CHOICES = ['CLASSIC', 'CHAOS'] ALL_SPRITES.add(SELECTOR_BIG) TEXTS1 = g.FONTNORMAL.render('Choose Mode', True, g.WHITE) TEXTS2 = g.FONTNORMAL.render('Space To Continue', True, g.WHITE) SELECTOR = 0 while LOOP: for event in pygame.event.get(): if event.type == pygame.QUIT: pygame.quit() sys.exit() # Keymap elif event.type == pygame.KEYDOWN: if event.key == pygame.K_UP: SELECTOR += 1 SELECTOR_BIG.pos[1] -= 100 if event.key == pygame.K_DOWN: SELECTOR -= 1 SELECTOR_BIG.pos[1] += 100 if event.key == pygame.K_SPACE: # Load Mode into variable to use later g.MODE = MODE_CHOICES[SELECTOR] d.GAME_DICT['MODE'][g.MODE]['SOUND'].play() LOOP = False if event.key in (pygame.K_UP, pygame.K_DOWN): SELECTOR %= len(MODE_CHOICES) g.MODE = MODE_CHOICES[SELECTOR] m.MEDIA['select_sound'].play() ALL_SPRITES.update() # Drawing m.SCREEN.fill(g.BLACK) m.SCREEN.blit(m.MEDIA['classic_card'], (150, 200)) m.SCREEN.blit(m.MEDIA['chaos_card'], (150, 300)) m.SCREEN.blit(TEXTS1, (155, 100)) m.SCREEN.blit(TEXTS2, (120, 500)) ALL_SPRITES.draw(m.SCREEN) pygame.display.flip() CLOCK.tick(60)
def MODE_SELECT(): CLOCK = pygame.time.Clock() LOOP = True ALL_SPRITES = pygame.sprite.Group() SELECTOR_BIG = S.SELECTOR_BIG((250, 250)) MODE_CHOICES = ['CLASSIC', 'CHAOS'] ALL_SPRITES.add(SELECTOR_BIG) SELECTINT = 0 while LOOP: for event in pygame.event.get(): if event.type == pygame.QUIT: pygame.quit() sys.exit() # Keymap elif event.type == pygame.KEYDOWN: if event.key == pygame.K_UP: SELECTINT += 1 SELECTOR_BIG.pos[1] -= 100 if event.key == pygame.K_DOWN: SELECTINT -= 1 SELECTOR_BIG.pos[1] += 100 if event.key == pygame.K_SPACE: '''Loads values into G.MODE''' G.MODE = MODE_CHOICES[SELECTINT] D.MODE_DICT[G.MODE]['SOUND'].play() LOOP = False if event.key in (pygame.K_UP, pygame.K_DOWN): SELECTINT %= len(MODE_CHOICES) G.MODE = MODE_CHOICES[SELECTINT] D.MEDIA['select_sound'].play() ALL_SPRITES.update() # Drawing G.SCREEN.fill(G.BLACK) G.SCREEN.blit(D.MEDIA['classic_card'], (150, 200)) G.SCREEN.blit(D.MEDIA['chaos_card'], (150, 300)) ALL_SPRITES.draw(G.SCREEN) G.SCREEN.blit(D.MEDIA['mode_select_border'], (0, 0)) pygame.display.flip() CLOCK.tick(60)