From fae6e717a46b9651c6bc89c99a8e028438e68ad9 Mon Sep 17 00:00:00 2001 From: Mateu Batle Date: Fri, 03 Dec 2010 01:52:36 +0000 Subject: fixed problem in performance fixed problems with maximum numbers for n --- (limited to 'game2') diff --git a/game2/game2.py b/game2/game2.py index 8294c7e..deca49e 100755 --- a/game2/game2.py +++ b/game2/game2.py @@ -129,6 +129,9 @@ class Game2(usmpgames.ApplicationState): rectBunny = bunnyImageF.rect self.new_operation = True + global background + background = load_image('./media/images/yard.jpg') + def entering_state(self, fromStack, cookie): usmpgames.ApplicationState.entering_state(self, fromStack, cookie) @@ -236,7 +239,6 @@ class Game2(usmpgames.ApplicationState): if self.new_operation: self.new_operation = False #print ('loopTime: '+str(a)) - background = Application.get_resource_background ('./media/images/yard.jpg') self.screen().blit(background, (0,0) ) surface = self.screen() @@ -289,7 +291,7 @@ class Game2(usmpgames.ApplicationState): #random.randint(max(result-4,1), min(99,result+4)) number1 = random.randint(max(n-5,0),n+1)+1 number2 = random.randint(max(n-5,0),n+1)+1 - while (number1>10 or number2 >10): + while (number1>9 or number2 >9): number1 = random.randint(max(n-5,0),n+1)+1 number2 = random.randint(max(n-5,0),n+1)+1 result=number1*number2 @@ -348,7 +350,6 @@ class Game2(usmpgames.ApplicationState): carrots.remove(b) # Draw background on game - background = Application.get_resource_background ('./media/images/yard.jpg') self.screen().blit(background, (0,0) ) #surface.fill(BACKGROUNDCOLOR) @@ -402,8 +403,10 @@ class Game2(usmpgames.ApplicationState): drawText(_('RESPUESTA CORRECTA!'), font, surface, (WINDOWWIDTH / 3.5), (WINDOWHEIGHT / 2.25), TEXTCOLOR) if(GAMEMODE==3): n=n+1 + n=min(10,n) else: - n=n+5 + n=n+2 + n=min(49,n) #print ('n cambio a :'+str(n)) drawText(_('PULSA UNA TECLA'), font, surface, (WINDOWWIDTH / 3), (WINDOWHEIGHT / 2.25) + 50,TEXTCOLOR) -- cgit v0.9.1