Ejemplo n.º 1
0
    def __init__(self, config):
        super().__init__(resizable=True, caption='Pyno', config=config)
        self.set_minimum_size(320, 200)
        self.set_size(800, 600)

        # set window position to center
        screen = self.display.get_default_screen()
        self.set_location(screen.width // 2 - 400, screen.height // 2 - 300)

        pyglet.clock.schedule(self.update)

        self.nodes = []
        self.active_nodes = []
        self.selected_nodes = []

        self.pyno_namespace = {}  # local space for in-pyno programs
        self.pyno_namespace['G'] = self.pyno_namespace  # to get global stuff

        self.code_editor = None
        self.field = None
        self.node_drag = False
        self.select = False
        self.connection = False
        self.connecting_node = None
        self.nodes_check = 0

        self.w, self.c = (0, 0), (0, 0)
        self.mouse = (0, 0)
        self.pointer = (0, 0)
        self.line = ()
        self.pan_scale = [[0.0, 0.0], 1]

        self.batch = None
        self.info_label, self.pyno_logo, self.menu = None, None, None

        self.new_batch()

        self.info_timer = 0.0
        self.autosave_timer = 0.0

        # open auto-save or welcome-file
        menu.paste_nodes(
            self,
            (menu.load('.auto-saved.pn') or menu.load('examples/welcome.pn')))
Ejemplo n.º 2
0
while True:
    if globalvars.newgame:
        # load save game
        globalvars.hero = pc.PC("Cole", CENTERCENTER)
        globalvars.heroGroup.empty()
        globalvars.heroGroup.add(globalvars.hero)
        globalvars.solidGroup.empty()
        globalvars.solidGroup.add(globalvars.hero)
        globalvars.attackGroup.empty()
        globalvars.itemGroup.empty()
        path = join(getcwd(), "savedata")
        savelist = listdir(path)
        if len(savelist) > 1:
            if menu.dialogue("Do you want to load the saved game?"):
                menu.load("save1.py")
            else:
                menu.get_name()
        else:
            menu.get_name()
        # set up groups
        world = World()
        globalvars.newgame = False
    
    # handle game events
    for event in pygame.event.get():
        if event.type == QUIT:
            pygame.quit()
            sys.exit()
        elif event.type == KEYDOWN:
            if event.key == K_ESCAPE:
Ejemplo n.º 3
0
while True:
    if globalvars.newgame:
        # load save game
        globalvars.hero = pc.PC("Cole", CENTERCENTER)
        globalvars.heroGroup.empty()
        globalvars.heroGroup.add(globalvars.hero)
        globalvars.solidGroup.empty()
        globalvars.solidGroup.add(globalvars.hero)
        globalvars.attackGroup.empty()
        globalvars.itemGroup.empty()
        path = join(getcwd(), "savedata")
        savelist = listdir(path)
        if len(savelist) > 1:
            if menu.dialogue("Do you want to load the saved game?"):
                menu.load("save1.py")
            else:
                menu.get_name()
        else:
            menu.get_name()
        # set up groups
        world = World()
        globalvars.newgame = False

    # handle game events
    for event in pygame.event.get():
        if event.type == QUIT:
            pygame.quit()
            sys.exit()
        elif event.type == KEYDOWN:
            if event.key == K_ESCAPE:
Ejemplo n.º 4
0
        'images/intro/DL2.png',
        time_scroll=400,
        speed_mod=1)

    menu.experiment_loop(
        'Много времени прошло с тех времён. Память о первой Войне Сил, проходившей в небесах, сохранилась 	только в легендах и священных текстах. Но зло в сердцах людей дало свои всходы. Сыны тьмы начали войну на Земле против людей света.',
        'images/intro/cl.png',
        pic_x=10,
        time_scroll=100)

    menu.experiment_loop(
        'Это была вторая Война Сил, которая оказалась столь разрушительна, что большая часть мира превратилась в безлюдную пустошь, наполненную тварями, порождёнными Войной...',
        'images/intro/2.gif',
        time_scroll=50)

menu.load()

#menu.help_loop()


def main_loop():
    while True:
        control.control()  #control loop, control of events, keys press
        hero.transcendental_apperception(
        )  #construct and render all the world from the character itself
        pygame.display.update()  #update the screen


#def menu_loop():

Ejemplo n.º 5
0
    "FirstAppearance": 1
}]
os.system("cls")
#This is the start of the main function
while True:  #This loop is to ensure that the program does not just terminate after a single command
    command = menu.menu()

    if command == 1:
        menu.searchToy(toys)
    elif command == 2:
        toys = menu.declutter(toys)
    elif command == 3:
        added_toy = menu.addToys(toys)
        toys.append(added_toy)
    elif command == 4:
        menu.edit_toy(toys)
    elif command == 5:
        menu.playtime(toys)
    elif command == 6:
        selected_toy = menu.select_toy(toys)
    elif command == 7:
        menu.print_toy(toys)
    elif command == 8:
        menu.save(toys)
    elif command == 9:
        toys = menu.load(toys)
    elif command == 0:
        print("\n================================================\n" +
              "It's bedtime! Sleep dreams!\n" +
              "================================================\n")
        break
Ejemplo n.º 6
0
def load_menu():
    """ Load the default menu """
    global frame
    menu.load(load_menu_multi, None, load_menu_options)
    frame = menu.frame