示例#1
0
def mostrarpuntajes(nom, screen):
	nombre= nombre=	"puntajes/"+nom
	lista=funciones.abrirarchivo(nombre)
	fon = pygame.font.SysFont(None, 40)
	listo=Option("Volver", (340,285))
	band = False
	try:
		fondo = pygame.image.load("image/mapa-mundi.jpg")
	except pygame.error:
		band = True	
	done=False
	while not done:
		x=250
		y=50
		cont=0
		pygame.event.pump()
		confondo(screen, band, fondo)
		for puntajes in lista:
			cont+=1
			if cont == 6:
				x=450
				y=50
			texto = fon.render(str(puntajes[0])+' '+str(puntajes[1]), True, (0,0,0))
			screen.blit(texto, (x, y))
			y+=50
		if listo.rect.collidepoint(pygame.mouse.get_pos()):
			listo.hovered = True	
			for event in pygame.event.get():
				if event.type == pygame.QUIT:
					done = True
					break
				if(event.type == pygame.MOUSEBUTTONDOWN):
					done=True	
		listo.draw()		
		pygame.display.update()
示例#2
0
def compararpuntaje(punt, nom):
	nombre=	"puntajes/"+nom
	lista=funciones.abrirarchivo(nombre)
	
	for obj in lista:
		if obj[1] < punt:
			return True
	return False		
示例#3
0
def guardarpuntaje(obj, punt, nombre):
	nom=[obj[0].getletra()+obj[1].getletra()+obj[2].getletra(),punt]
	lista=[]
	lista=funciones.abrirarchivo('puntajes/'+nombre)
	aux=[]
	for obj in lista:
		if obj[1]< nom[1]:
			aux=nom[:]
			nom[0]=obj[0]
			nom[1]=obj[1]
			obj[0]=aux[0]
			obj[1]=aux[1]				
	guardararchivo(lista,nombre)