def title(ww,hh,full,start): global win, high_score, crate_tot, selected_skin savefiler = open('resources/save.txt','r') high_score = savefiler.readline() crate_tot = eval(savefiler.readline()) unlocks = savefiler.readline() selected_skin = eval(savefiler.readline()) savefiler.close() if start == True: win = GraphWin('Game3',ww,hh,fullscreen=full,autoflush=False) win.setCoords(0,0,1920,1080) l1 = Text(Point(960,800),'Game3') l1.setFace('helvetica');l1.setSize(35);l1.draw(win) ct = Text(Point(960,200),'Caish: '+str(crate_tot)) ct.setFace('helvetica');ct.draw(win) hs = Text(Point(960,100),'High Score: '+high_score) hs.setFace('helvetica');hs.draw(win) win.update() c = buttons.buttonChoice3(20,280,1900,600,'Play','Quit','Shop',win,True) if c == 1: win.clear() win.update() if start: return win,'game' else: return 'game' elif c==3: win.clear() win.update() if start: return win,'shop' else: return 'shop' else: win.quit() sys.exit()
def overlay(selection,costs,caish,names,selected_skin,high_score,win,clicks,screen): global getout savefiler = open('resources/save.txt','r') high_score = savefiler.readline() caish = eval(savefiler.readline()) unlocks = list(savefiler.readline()) selected_skin = savefiler.readline() savefiler.close() if selection == op1: sel = 1 elif selection == op2: sel =2 elif selection == op3: sel =3 elif selection == op4: sel =4 elif selection == op5: sel =5 elif selection == op6: sel =6 elif selection == op7: sel =7 elif selection == op8: sel =8 elif selection == op9: sel = 9 elif selection == op10: sel = 10 elif selection == back and screen == 2: win.clear() shop(win,1) getout = True return elif selection == back and screen == 1: return elif selection == forwards and screen == 2: return elif selection == forwards and screen == 1: win.clear() shop(win,2) getout = True return elif selection == backback: backback.setFill('grey') win.update() time.sleep(.2) win.clear() savefilew = open('resources/save.txt','w') print(high_score,file=savefilew,end='') print(caish,file=savefilew) print(''.join(unlocks),file=savefilew,end='') print(selected_skin,file=savefilew) savefilew.close() return if unlocks[sel-1] == 'T': selectable = True else: selectable = False overekt = Rectangle(Point(310,250),Point(1610, 900));overekt.setFill('lightgrey');overekt.setWidth(2);overekt.draw(win) l2 = Text(Point(960,300),'Total Caish: '+str(caish));l2.setFace('helvetica');l2.setSize(20);l2.draw(win) l3 = Text(Point(960,800),names[sel-1]);l3.setFace('helvetica');l3.setSize(25);l3.draw(win) if unlocks[sel-1] == 'F' and caish >= costs[sel-1]: buyable = True else: buyable = False selected_skin2 = selected_skin yay = buttons.buttonChoice3(350,350,1570,750,'Buy','Equip','Back',win,True,b1e = buyable,b2e=selectable) if yay == 1: caish -= costs[sel-1] unlocks[sel-1] = 'T' selected_skin = sel-1 elif yay == 2: selected_skin = sel-1 l2.undraw();l3.undraw();overekt.undraw() clicks[int(selected_skin2)+2].setWidth(1);clicks[int(selected_skin2)+2].setOutline('black') clicks[int(selected_skin)+2].setWidth(4);clicks[int(selected_skin)+2].setOutline('green') win.update() savefilew = open('resources/save.txt','w') print(high_score,file=savefilew,end='') print(caish,file=savefilew) print(''.join(unlocks),file=savefilew,end='') print(selected_skin,file=savefilew) savefilew.close()