diff options
author | Mateu Batle <mateu.batle@collabora.co.uk> | 2010-12-06 19:26:08 (GMT) |
---|---|---|
committer | Mateu Batle <mateu.batle@collabora.co.uk> | 2010-12-06 19:26:08 (GMT) |
commit | 01901653dc9f473541e4eee4382f8aea2b960082 (patch) | |
tree | fde81539e17425d361385ba86d7e97942291631a | |
parent | 3fc0dcb9f03352b01818f6b4078baa55a938eafa (diff) |
Added more visual feedback to game 2
Added images for good and bad responses
-rw-r--r-- | MANIFEST | 2 | ||||
-rwxr-xr-x | game2/game2.py | 44 | ||||
-rw-r--r-- | media/images/bien.png | bin | 0 -> 10049 bytes | |||
-rw-r--r-- | media/images/mal.png | bin | 0 -> 43431 bytes |
4 files changed, 40 insertions, 6 deletions
@@ -119,3 +119,5 @@ data/backgrounds/menu.jpg media/images/cuya.jpg media/images/yard.jpg media/images/reduced/cuya1.jpg +media/images/bien.png +media/images/mal.png diff --git a/game2/game2.py b/game2/game2.py index 3c27abd..482d9ef 100755 --- a/game2/game2.py +++ b/game2/game2.py @@ -76,6 +76,11 @@ invisible=pygame.transform.scale(sad, (bunnySize-25, bunnySize)) looking=pygame.image.load('./media/images/looking.png') looking=pygame.transform.scale(looking, (bunnySize-45, bunnySize)) +message_ok = pygame.image.load('./media/images/bien.png') +message_bad = pygame.image.load('./media/images/mal.png') +rect_ok = message_ok.get_rect() +rect_bad = message_bad.get_rect() + #NUMBERS number1=0 number2=0 @@ -400,7 +405,11 @@ class Game2(usmpgames.ApplicationState): rectBunny.move_ip(-35, 0) #surface.blit(happy, rectBunny) surface.blit(happy, rectBunny) - drawText(_('RESPUESTA CORRECTA!'), font, surface, (WINDOWWIDTH / 3.5), (WINDOWHEIGHT / 2.25), TEXTCOLOR) + rect_ok.center = ( WINDOWWIDTH / 2, WINDOWHEIGHT / 2 ) + global rect_ok, message_ok + surface.blit(message_ok, rect_ok) + drawText(_("BIEN !"), font, surface, rect_ok.left + 125, rect_ok.top + 125, TEXTCOLOR) + #drawText(_('RESPUESTA CORRECTA!'), font, surface, (WINDOWWIDTH / 3.5), (WINDOWHEIGHT / 2.25), TEXTCOLOR) if(GAMEMODE==3): n=n+1 n=min(10,n) @@ -409,7 +418,7 @@ class Game2(usmpgames.ApplicationState): n=min(49,n) #print ('n cambio a :'+str(n)) - drawText(_('PULSA UNA TECLA'), font, surface, (WINDOWWIDTH / 3), (WINDOWHEIGHT / 2.25) + 50,TEXTCOLOR) + #drawText(_('PULSA UNA TECLA'), font, surface, (WINDOWWIDTH / 3), (WINDOWHEIGHT / 2.25) + 50,TEXTCOLOR) musicSound.stop() correctAnswerSound.play() score=returnScore() @@ -422,10 +431,33 @@ class Game2(usmpgames.ApplicationState): surface.blit(sad, rectBunny) #surface.blit(sad, rectBunny) score=returnScore() - drawText(_('RESPUESTA INCORRECTA!'), font, surface, (WINDOWWIDTH / 4), (WINDOWHEIGHT / 2.25), TEXTCOLOR) - drawText(_('RESPUESTA CORRECTA: '+str(result)), font, surface, (WINDOWWIDTH / 3.8), (WINDOWHEIGHT / 2.25)+50, TEXTCOLOR) - - drawText(_('PULSA UNA TECLA'), font, surface, (WINDOWWIDTH / 3), (WINDOWHEIGHT / 2.25) + 100, TEXTCOLOR) + #drawText(_('RESPUESTA INCORRECTA!'), font, surface, (WINDOWWIDTH / 4), (WINDOWHEIGHT / 2.25), TEXTCOLOR) + #drawText(_('RESPUESTA CORRECTA: '+str(result)), font, surface, (WINDOWWIDTH / 3.8), (WINDOWHEIGHT / 2.25)+50, TEXTCOLOR) + #drawText(_('PULSA UNA TECLA'), font, surface, (WINDOWWIDTH / 3), (WINDOWHEIGHT / 2.25) + 100, TEXTCOLOR) + global rect_bad, message_bad + rect_bad.center = ( WINDOWWIDTH / 2, WINDOWHEIGHT / 2 ) + rect_bad.left = rectBunny.left - 150 + if rect_bad.left < 0: + rect_bad.left = 0 + if rect_bad.right > WINDOWWIDTH: + rect_bad.right = WINDOWWIDTH + surface.blit(message_bad, rect_bad) + drawText(_("INCORRECTO"), font, surface, rect_bad.left + 30, rect_bad.top + 70, TEXTCOLOR) + text = "" + if(GAMEMODE==1): + #This draw the operation + text = _('%d+%d') % (number1,number2) + elif(GAMEMODE==2): + #This draw the operation + text = _('%d-%d') % (number1,number2) + elif(GAMEMODE==3): + #This draw the operation + text = _('%dx%d') % (number1,number2) + elif(GAMEMODE==4): + #This draw the operation + text = "" + drawText(text, font, surface, rect_bad.left + 50, rect_bad.top + 170, TEXTCOLOR) + drawText(str(result), font, surface, rect_bad.left + 260, rect_bad.top + 170, TEXTCOLOR) musicSound.stop() gameOverSound.play() pygame.display.update() diff --git a/media/images/bien.png b/media/images/bien.png Binary files differnew file mode 100644 index 0000000..719d737 --- /dev/null +++ b/media/images/bien.png diff --git a/media/images/mal.png b/media/images/mal.png Binary files differnew file mode 100644 index 0000000..3ea9d41 --- /dev/null +++ b/media/images/mal.png |