From 8f6895f91e54534b585edc4ad76fbd9c29d0688a Mon Sep 17 00:00:00 2001 From: Mateu Batle Date: Mon, 15 Nov 2010 03:31:27 +0000 Subject: fixed timelimit and score not reset on every new game fixed crash in game 2 fixed strings for spanish as default --- (limited to 'game2') diff --git a/game2/game2.py b/game2/game2.py index dd0d6e1..18fbc6b 100755 --- a/game2/game2.py +++ b/game2/game2.py @@ -139,6 +139,11 @@ class Game2(usmpgames.ApplicationState): global GAMEMODE n = 0 GAMEMODE = self.game_mode + #Get initial time + global TIMESTART + TIMESTART= round(time.time(),0) + global score + score = 0 def exiting_state(self, fromStack): global score @@ -208,7 +213,7 @@ class Game2(usmpgames.ApplicationState): number2 = random.randint(max(n-15,0),n) z=min(number1,number2) number1=max(number1,number2) - number2=zImages() + number2=z result=number1-number2 result=number1-number2 elif(GAMEMODE==3): @@ -233,7 +238,7 @@ class Game2(usmpgames.ApplicationState): #print ('number1: '+str(number1)+' number2: '+str(number2)+' result: '+str(result)) - while True: # Score loop + while self.running(): # Score loop #score += 1 # increase score for event in pygame.event.get(): @@ -350,24 +355,24 @@ class Game2(usmpgames.ApplicationState): # Show score and maximum score global maxScore global score - drawText(_('SCORE: %s') % (score), font, surface, 700, 0, TEXTCOLOR) - drawText(_('MAX SCORE: %s') % (maxScore), font, surface, 700, 60, TEXTCOLOR) + drawText(_('PUNTAJE: %s') % (score), font, surface, 700, 0, TEXTCOLOR) + drawText(_('PUNTAJE MAX: %s') % (maxScore), font, surface, 700, 60, TEXTCOLOR) if(GAMEMODE==1): #This draw the operation - drawText(_('ADD: %d + %d') % (number1,number2), font, surface, 10, 0, TEXTCOLOR) + drawText(_('SUMAR: %d + %d') % (number1,number2), font, surface, 10, 0, TEXTCOLOR) elif(GAMEMODE==2): #This draw the operation - drawText(_('SUBSTRACT: %d - %d') % (number1,number2), font, surface, 10, 0, TEXTCOLOR) + drawText(_('RESTAR: %d - %d') % (number1,number2), font, surface, 10, 0, TEXTCOLOR) elif(GAMEMODE==3): #This draw the operation - drawText(_('MULTIPLY: %d * %d') % (number1,number2), font, surface, 10, 0, TEXTCOLOR) + drawText(_('MULTIPLICAR: %d x %d') % (number1,number2), font, surface, 10, 0, TEXTCOLOR) elif(GAMEMODE==4): #This draw the operation - drawText(_('COUNT: '), font, surface, 10, 0, TEXTCOLOR) + drawText(_('CONTAR '), font, surface, 10, 0, TEXTCOLOR) medC=0 i=0 while(i