def newGeneration(): generation.init() print utils.prettyPrint(generation.get(), generation.getScores()) genMenu()
def restart(): generation.init() del content[:] del content2[:] update()
import pygame # Imports Pygame import generation import colorSelector pygame.init() # Initialize Pygame generation.init() gameDisplay = pygame.display.set_mode((350, 350)) # Window size pygame.display.set_caption("Lights Out") # Window title m = pygame.image.load(r"Images\\menu.png") # Load menu screen image icon = pygame.image.load(r"Images\\icon.png") # Load icon image pygame.display.set_icon(icon) # Window icon rectA = [0, 0, 10, 10] # Rectangle parameters running = True # Boolean for game loop running menu = False # Boolean for menu while running: # Game loop gameDisplay.fill([33, 22, 15]) # Background color update for event in pygame.event.get(): # Event stuff if event.type == pygame.QUIT: # If they press the X on the window running = False # Game loop condition turns false if event.type == pygame.KEYUP: # If they let go of a key if event.key != pygame.K_ESCAPE: # If that key is not the escape key if menu: menu = False if event.key == pygame.K_ESCAPE: # If that key is the escape key if menu == False: menu = True elif menu: running = False generation.generate.mouse(0) if menu: # If the program is supposed to open the menu gameDisplay.blit(m, (175 - (m.get_size()[0] / 2), 175 -
('controls', 'light gray', 'black') ] text_controls = [ ('key', ' J'), ('controls', ' - Next Generation\n'), ('key', ' R'), ('controls', ' - Start Over\n'), '\n', ('key', ' M'), ('controls', ' - MIDI Output\n'), ('key', ' E'), ('controls', ' - DNA Export\n'), '\n', ('key', ' Q'), ('controls', ' - Quit') ] midifocus = False dnafocus = False generation.init() currentGen = utils.prettyPrint(generation.get(), generation.getScores()) prevGen = "" def updateHeaders(): current = generation.getAge() if current == 0: prev = 0 else: prev = current-1 leftheader.set_text([('title', 'Current Generation'), ('title', ' (' + str(current) + ')')]) leftheader2.set_text([('title', 'Previous Generation'), ('title', ' (' + str(prev) + ')')]) content = [urwid.Text(currentGen)] leftheader = urwid.Text('') leftc = urwid.ListBox(content)
import random as r import pygame as py import collisions as c import entities as e import equipment as eq import generation as g import settings as s import visuals as v import combat as c2 import util as u from datetime import datetime py.init() g.init() e.init() eq.init() e.Player() v.init() c2.init() box_size = 32 white = (255, 255, 255) black = (0, 0, 0) selected = 0 '''numpad = (py.K_KP1, py.K_KP2, py.K_KP3, py.K_KP4, py.K_KP5, py.K_KP6, py.K_KP7, py.K_KP8, py.K_KP9)''' def reset():