diff options
author | drako <drako@drako-desktop.(none)> | 2010-09-08 20:42:51 (GMT) |
---|---|---|
committer | drako <drako@drako-desktop.(none)> | 2010-09-08 20:42:51 (GMT) |
commit | f2e13f1df02ac66bd73163697d5e8cea9a2be5fa (patch) | |
tree | 318506912eb2ed89278583eef711ee85547f8877 | |
parent | d7d32095b35d4f962beb38b08b98cddb6adb4fe5 (diff) |
a new class has been created name newhigscores and its implementation is in almost all the
so i have to put it newhigscore uses things of pares impares etc so some things have been added
-rwxr-xr-x | highScores.py | 1 | ||||
-rwxr-xr-x | impares.py | 3 | ||||
-rw-r--r-- | newhighscore.py | 36 | ||||
-rwxr-xr-x | pares.py | 3 | ||||
-rwxr-xr-x | runEsquiadorFunc.py | 117 | ||||
-rwxr-xr-x | score.dat | 5 |
6 files changed, 106 insertions, 59 deletions
diff --git a/highScores.py b/highScores.py index 97bfecc..09989a6 100755 --- a/highScores.py +++ b/highScores.py @@ -16,7 +16,6 @@ class HighScore(): temp = line.split('\t') items.append((int(temp[1].strip()), (temp[0]))) file.close() - return items def numeric_compare(self, x, y): @@ -12,7 +12,7 @@ from score import * from constants import * LOG_FILENAME='Esquiador.log' - +skier = None log = logging.getLogger( 'EsquiadorRun' ) #log.setLevel( logging.DEBUG ) @@ -26,6 +26,7 @@ def mainImpares(): if olpcgames.ACTIVITY: size = olpcgames.ACTIVITY.game_size screen = pygame.display.set_mode(size) + global skier skier = Skier('impares') track = Track() score = Score(skier) diff --git a/newhighscore.py b/newhighscore.py new file mode 100644 index 0000000..25eeeca --- /dev/null +++ b/newhighscore.py @@ -0,0 +1,36 @@ +import pygame, highScores,pares,impares,logging,os +from highScores import * +from pygame.locals import * +h = HighScore() + +class newhighscore(): + + + def __init__(self): + newScore = 0 + global item + item = h.loadscores() + global scorew + scorew = [] + i=0 + for i in range(len(item)): + scorew.append(item[i][0]) + print scorew + def main(self,newscore): + newenter = False + for score in scorew[:len(item)]: + if score < newscore : + newenter = True + if newenter == True: + item.append((newscore,os.getlogin())) + h.savescores(item) + else: + print "nooooo" + + LOG_FILENAME='Esquiador.log' + + log = logging.getLogger( 'EsquiadorRun' ) + #log.setLevel( logging.DEBUG ) + if __name__=="__main__": + logging.basicConfig(filename=LOG_FILENAME,level=logging.DEBUG) + main() @@ -12,7 +12,7 @@ from score import * from constants import * LOG_FILENAME='Esquiador.log' - +skier = None log = logging.getLogger( 'EsquiadorRun' ) #log.setLevel( logging.DEBUG ) @@ -26,6 +26,7 @@ def mainPares(): if olpcgames.ACTIVITY: size = olpcgames.ACTIVITY.game_size screen = pygame.display.set_mode(size) + global skier skier = Skier('pares') track = Track() score = Score(skier) diff --git a/runEsquiadorFunc.py b/runEsquiadorFunc.py index b40ec43..e89682b 100755 --- a/runEsquiadorFunc.py +++ b/runEsquiadorFunc.py @@ -1,74 +1,83 @@ -import pygame, jmenu, impares, pares, olpcgames, logging, finishGame, sys, about, help, highScores +import pygame, jmenu, impares, pares, olpcgames, logging, finishGame, sys, about, help, highScores, newhighscore from impares import * from pares import * from constants import * from finishGame import * from about import * from help import * +from newhighscore import * from highScores import * from constants import * highScore = HighScore() +nh = newhighscore() def estadoJugador(self, estado): self.jugador=estado +def main(): + LOG_FILENAME='Esquiador.log' + log = logging.getLogger( 'EsquiadorRun' ) + #log.setLevel( logging.DEBUG ) -LOG_FILENAME='Esquiador.log' -log = logging.getLogger( 'EsquiadorRun' ) -#log.setLevel( logging.DEBUG ) + screen = pygame.display.set_mode(screen_size) + bg = imagenFondo; -screen = pygame.display.set_mode(screen_size) -bg = imagenFondo; - -pygame.display.flip() -color = (0,0,0) -font = './fonts/ice_sticks.ttf' -just = True -pos = ('center','center') - -while pygame.event.poll().type != pygame.QUIT: - screen.blit(bg, (0,0) ) - selection = jmenu.run(['Numeros pares','Numeros impares','Puntajes mas altos' ,'Ayuda','Acerca de','Salir'],color,42,font=font,light=10,justify=just,pos=pos) - if selection == 'Numeros pares': - just = True - pos = ('center','center') + pygame.display.flip() color = (0,0,0) - font = font - try: - pares.mainPares() - except IndexError: - print 'Termino el juego de pares!!!' - finishGame.finishing() - elif selection == 'Numeros impares': + font = './fonts/ice_sticks.ttf' just = True pos = ('center','center') - color = (0,0,0) - font = font - try: - impares.mainImpares() - except IndexError: - print 'Termino el juego de impares!!!' - finishGame.finishing() - elif selection == 'Puntajes mas altos': - just = True - pos = ('center','center') - color = (0,0,0) - font = font - highScore.mainHighScores() - elif selection == 'Ayuda': - just = True - pos = ('center','center') - color = (0,0,0) - font = font - help.mainHelp() - elif selection == 'Acerca de': - just = True - pos = ('center','center') - color = (0,0,0) - font = font - about.mainAbout() - elif selection == 'Salir' : - sys.exit(0) - #break + + while pygame.event.poll().type != pygame.QUIT: + screen.blit(bg, (0,0) ) + selection = jmenu.run(['Numeros pares','Numeros impares','Puntajes mas altos' ,'Ayuda','Acerca de','Salir'],color,42,font=font,light=10,justify=just,pos=pos) + if selection == 'Numeros pares': + just = True + pos = ('center','center') + color = (0,0,0) + font = font + try: + pares.mainPares() + except IndexError: + print 'Termino el juego de pares!!!' + global skier + nh.main(pares.skier.score) + finishGame.finishing(pares.skier.score,"pares") + elif selection == 'Numeros impares': + just = True + pos = ('center','center') + color = (0,0,0) + font = font + try: + impares.mainImpares() + except IndexError: + print 'Termino el juego de impares!!!' + global skier + nh.main(impares.skier.score) + finishGame.finishing(impares.skier.score,"impares") + elif selection == 'Puntajes mas altos': + just = True + pos = ('center','center') + color = (0,0,0) + font = font + highScore.mainHighScores() + elif selection == 'Ayuda': + just = True + pos = ('center','center') + color = (0,0,0) + font = font + help.mainHelp() + elif selection == 'Acerca de': + just = True + pos = ('center','center') + color = (0,0,0) + font = font + about.mainAbout() + elif selection == 'Salir' : + sys.exit(0) + #break +if __name__=="__main__": + logging.basicConfig(filename=LOG_FILENAME,level=logging.DEBUG) + main() @@ -1,4 +1,5 @@ +drako 27955 +drako 26520 +drako 25919 EDUARDO 20000 MATEU 10000 -RICARDO 9000 -ALDO 3000 |