Esempio n. 1
0
def reset():
    SCREEN.fill(0x100005)
    for i,j in (('select the category you want to reset the save',20),('hit ESC to quit',55)):
        SCREEN.blit(FONT25.render(i,1,(250,200,150)),(20,j))
    display.flip()
    menu = []
    with open(os.path.join(os.path.dirname(__file__),'save.txt'),'r') as s:
        out = s.readlines()
        menu = [i.replace(':','    ').strip() for i in out[1:]]
    if not menu: return
    while menu:
        #SCREEN.fill(0x100005)
        #display.flip()
        choix = slidemenu.menu(menu+['','All'],color1=(150,150,250),interline=10,font1=FONT35,light=5,justify=False,neon=False)[0]
        if choix == None: return
        elif choix == 'All':
            out = out[:1]
            break
        index = menu.index(choix)
        del(menu[index])
        del(out[index+1])
    if choix and Confirm.get('Do you really want to delete your progress ?'):
        with open(os.path.join(os.path.dirname(__file__),'save.txt'),'w') as s: s.write(''.join(out))
Esempio n. 2
0
def load_categs():
    global CATEG,NUM_LEVEL,NAME_CATEG
    categs = listdir(categrep)
    categs.sort()
    menu = categs[:]
    with open(os.path.join(os.path.dirname(__file__),'save.txt'),'r') as s:
        a,b = zip(*[i.strip().split(':') for i in s.readlines()])
        for e,i in enumerate(menu):
            try:
                index = a.index(i)
                menu[e] += '   '+b[index]
            except: continue
    NAME_CATEG = slidemenu.menu(menu,color1=(150,150,250),interline=10,font1=FONT35,light=8,justify=False,speed=450,neon=False)[0]
    if NAME_CATEG == None: return
    index = menu.index(NAME_CATEG)
    NAME_CATEG = categs[index]
    with open(os.path.join(categrep,NAME_CATEG),'r') as CATEG:
        CATEG = CATEG.read().replace('\r','').split(';')
        for index,level in enumerate(CATEG):
            level = level.split('\n')
            CATEG[index] = level[level.index('')+1:-2]
    try: NUM_LEVEL = int(b[a.index(NAME_CATEG)].split('/')[0])+1
    except: NUM_LEVEL = 1
Esempio n. 3
0
        if choix == None: return
        elif choix == 'All':
            out = out[:1]
            break
        index = menu.index(choix)
        del(menu[index])
        del(out[index+1])
    if choix and Confirm.get('Do you really want to delete your progress ?'):
        with open(os.path.join(os.path.dirname(__file__),'save.txt'),'w') as s: s.write(''.join(out))


while True:
    SCREEN.fill(0x100005)
    SCREEN.blit(intro,(0,0))
    display.flip()
    choix = slidemenu.menu(['START','RESET','QUIT GAME'],interline=10,color1=(150,150,250),font1=FONT35,topleft=(300,500),justify=False,speed=0,neon=False)[0]
    if choix == 'START':
        while True:
            SCREEN.fill(0x100005)
            select = FONT35.render('SELECT A CATEGEGORY',1,(200,200,255))
            R_select = select.get_rect()
            R_select.topleft = 20,20
            SCREEN.blit(select,R_select)
            display.flip()
            load_categs()
            if NAME_CATEG == None: break
            Play = True
            while NUM_LEVEL < len(CATEG):
                LEVEL = [list(s)for s in CATEG[NUM_LEVEL]]
                resize()
                draw_level()