Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/game2
diff options
context:
space:
mode:
authorMateu Batle <mateu.batle@collabora.co.uk>2010-12-03 01:52:36 (GMT)
committer Mateu Batle <mateu.batle@collabora.co.uk>2010-12-03 01:52:36 (GMT)
commitfae6e717a46b9651c6bc89c99a8e028438e68ad9 (patch)
tree077ce46aa254cf68866d387bc36078b44bc6d09b /game2
parentabf2e88c64033867c6c7ffebb072a9cabc10b02f (diff)
fixed problem in performance
fixed problems with maximum numbers for n
Diffstat (limited to 'game2')
-rwxr-xr-xgame2/game2.py11
1 files changed, 7 insertions, 4 deletions
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)