Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlan Aguiar <alanjas@hotmail.com>2014-02-09 14:00:50 (GMT)
committer Alan Aguiar <alanjas@hotmail.com>2014-02-09 14:00:50 (GMT)
commit753b36359b0df0e01f42db5aaae716b6bb745b5f (patch)
treeb63293bd97539df7e72d81fb06cce167b391be16 /src
parentf6cf2680baca971c98c597711aae1c2ffd9f479b (diff)
add end dialog and help in a1g5
Diffstat (limited to 'src')
-rw-r--r--src/assets/data/area1game3_data.py2
-rw-r--r--src/assets/data/area1game5_data.py2
-rw-r--r--src/game/Area1Game3.py1
-rw-r--r--src/game/Area1Game5.py306
4 files changed, 221 insertions, 90 deletions
diff --git a/src/assets/data/area1game3_data.py b/src/assets/data/area1game3_data.py
index 1cbe878..70b9c26 100644
--- a/src/assets/data/area1game3_data.py
+++ b/src/assets/data/area1game3_data.py
@@ -3,7 +3,7 @@
from gettext import gettext as _
-HELP = _('Ayuda a Elisa a\ncontestar las preguntas de Juan')
+HELP = _('Ayuda a contestar las\ndudas de Juan y Elisa')
DIALOG = [
_('Sabés que pasa\ncuando un chico\nse desarrolla?'),
diff --git a/src/assets/data/area1game5_data.py b/src/assets/data/area1game5_data.py
index 3f77e39..8cc4e06 100644
--- a/src/assets/data/area1game5_data.py
+++ b/src/assets/data/area1game5_data.py
@@ -2,6 +2,8 @@
from gettext import gettext as _
+HELP = _('Ayuda a contestar las\ndudas de Juan y Elisa')
+
DIALOG = [
_('¿Qué es masturbarse?'),
_('mmm... no sé muy bien..')
diff --git a/src/game/Area1Game3.py b/src/game/Area1Game3.py
index 40ee9fc..2799831 100644
--- a/src/game/Area1Game3.py
+++ b/src/game/Area1Game3.py
@@ -238,6 +238,7 @@ class CArea1Game3(CGameState):
CGame().addChild(self.mInstructions)
CGame().addChild(self.mButtonAccept)
return
+
if self.mCurrentState == 0:
CGame().addChild(self.mDialogBoy1)
CGame().addChild(self.mButtonNext)
diff --git a/src/game/Area1Game5.py b/src/game/Area1Game5.py
index 1f3e8cd..eee5856 100644
--- a/src/game/Area1Game5.py
+++ b/src/game/Area1Game5.py
@@ -14,6 +14,11 @@ from gettext import gettext as _
from assets.data import area1game5_data
+OVER_COLOR = (255, 0, 0)
+NORMAL_COLOR = (255, 125, 50)
+
+GOODS = 8
+BADS = 4
class CArea1Game5(CGameState):
@@ -21,7 +26,6 @@ class CArea1Game5(CGameState):
CGameState.__init__(self)
self.mBackground = None
-
self.mButtonBackA1G3 = None
self.mLabelQuestion = None
self.mButtonTrue = None
@@ -45,6 +49,14 @@ class CArea1Game5(CGameState):
self.time = 0
self.mBad = 0
self.mGood = 0
+ self.mDialog = None
+ self.mBBsetted = False
+ self.mNBsetted = True
+ self.mBHsetted = False
+ self.mNHsetted = True
+ self.mEndDialog = None
+ self.mAlphaSet = True
+ self.mHelpShowed = True
self.mBackground = Image.loadImage('assets/images/a1g3/a1game3.png', False)
CGame().setBackground(self.mBackground)
@@ -77,6 +89,15 @@ class CArea1Game5(CGameState):
self.mButtonBack.setRegistrationPointOffset(22, 22)
self.mButtonBack.setImage(self.mBackImageN)
CGame().addChild(self.mButtonBack)
+
+ # help button
+ self.mHelpImageN = Image.loadImage('assets/images/help.png')
+ self.mHelpImageB = Image.loadImage('assets/images/help_big.png')
+
+ self.mButtonHelp = CSprite(1110, 30)
+ self.mButtonHelp.setRegistrationPointOffset(22, 22)
+ self.mButtonHelp.setImage(self.mHelpImageN)
+ CGame().addChild(self.mButtonHelp)
self.mLabelQuestion = Globe((500, 150), pico='None', text=' ')
self.mLabelQuestion.set_center((600, 250))
@@ -84,19 +105,29 @@ class CArea1Game5(CGameState):
font28 = pygame.font.Font('assets/fonts/DejaVuSans.ttf', 28)
self.mButtonTrue = CButton()
- self.mButtonTrue.bgColor = (125, 255, 125)
+ #self.mButtonTrue.bgColor = (125, 255, 125)
+ self.mButtonTrue.bgColor = NORMAL_COLOR
self.mButtonTrue.font = font28
self.mButtonTrue.center = (460, 400)
self.mButtonTrue.size = (200, 40)
self.mButtonTrue.set_text(_('Verdadero'))
self.mButtonFalse = CButton()
- self.mButtonFalse.bgColor = (125, 255, 125)
+ #self.mButtonFalse.bgColor = (125, 255, 125)
+ self.mButtonFalse.bgColor = NORMAL_COLOR
self.mButtonFalse.font = font28
self.mButtonFalse.center = (740, 400)
self.mButtonFalse.size = (200, 40)
self.mButtonFalse.set_text(_('Falso'))
+ self.mButtonNext = CButton()
+ #self.mButtonNext.bgColor = (125, 255, 125)
+ self.mButtonNext.bgColor = NORMAL_COLOR
+ self.mButtonNext.font = font28
+ self.mButtonNext.center = (600, 500)
+ self.mButtonNext.size = (200, 40)
+ self.mButtonNext.set_text(_('Siguiente'))
+
self.mBoy = CSprite(100, 400)
self.mBoy.loadImage('assets/images/a1g3/Juan-chico-costado-parado.png')
CGame().addChild(self.mBoy)
@@ -125,104 +156,195 @@ class CArea1Game5(CGameState):
self.mPoints = CPoints(250, 10)
CGame().addChild(self.mPoints)
- #self.mTime = self.mDialogBoy1.getTimeState()
+ alphasurface = pygame.Surface((1200,900))
+ alphasurface.convert()
+ alphasurface.fill((100,100,100))
+ alphasurface.set_alpha(200)
+
+ self.mAlpha = CSprite(0, 0)
+ self.mAlpha.setImage(alphasurface)
+ CGame().addChild(self.mAlpha)
+
+ self.mButtonAccept = CButton()
+ self.mButtonAccept.bgColor = NORMAL_COLOR
+ self.mButtonAccept.font = font28
+ self.mButtonAccept.center = (600, 400)
+ self.mButtonAccept.size = (200, 40)
+ self.mButtonAccept.set_text(_('Aceptar'))
+ CGame().addChild(self.mButtonAccept)
+
+ msg = area1game5_data.HELP
+ self.mInstructions = Globe((450, 150), text=unicode(msg, 'UTF-8'), pico=None)
+ self.mInstructions.set_center((600, 300))
+ CGame().addChild(self.mInstructions)
+
self.mCurrentState = 0
self.time = 0
def update(self):
CGameState.update(self)
- self.time = self.time + 1
-
- if self.mButtonBack.mouseOver():
- if not(self.mBsetted):
- self.mBsetted = True
- self.mNsetted = False
- self.mButtonBack.setRegistrationPointOffset(27, 27)
- self.mButtonBack.setImage(self.mBackImageB)
- else:
- if not(self.mNsetted):
- self.mBsetted = False
- self.mNSetted = True
- self.mButtonBack.setRegistrationPointOffset(22, 22)
- self.mButtonBack.setImage(self.mBackImageN)
-
- if self.mButtonBack.clicked():
- #print "clicked back of a1g5"
- hs = HallState.CHallState()
- CGame().setState(hs)
- hs.setCurrentGame(4)
- return
+ if not(self.mAlphaSet):
- if self.mCurrentState == 0:
- #self.time = self.mListDialogs[0].getTimeState()
- if self.time > 4*30:
- CGame().removeChild(self.mDialogBoy1)
- CGame().addChild(self.mDialogGirl1)
- self.mCurrentState = 1
- self.time = 0
- #self.mListDialogs[1].setTimeState(0)
-
- elif self.mCurrentState == 1:
- #self.time = self.mListDialogs[1].getTimeState()
- if self.time > 3*30:
- CGame().removeChild(self.mDialogGirl1)
-
- self.mCurrentState = 2
- self.time = 0
- #self.mListDialogs[2].setTimeState(0)
+ if self.mButtonBack.mouseOver():
+ if not(self.mBBsetted):
+ self.mBBsetted = True
+ self.mNBsetted = False
+ self.mButtonBack.setRegistrationPointOffset(27, 27)
+ self.mButtonBack.setImage(self.mBackImageB)
+ else:
+ if not(self.mNBsetted):
+ self.mBBsetted = False
+ self.mNBSetted = True
+ self.mButtonBack.setRegistrationPointOffset(22, 22)
+ self.mButtonBack.setImage(self.mBackImageN)
-
- # Pregunta
- elif self.mCurrentState == 2:
- if self.mQuestionShowed == False:
- if self.next_questionB():
- CGame().addChild(self.mLabelQuestion)
- CGame().addChild(self.mButtonTrue)
- CGame().addChild(self.mButtonFalse)
- self.mQuestionShowed = True
+ if self.mButtonHelp.mouseOver():
+ if not(self.mBHsetted):
+ self.mBHsetted = True
+ self.mNHsetted = False
+ self.mButtonHelp.setRegistrationPointOffset(27, 27)
+ self.mButtonHelp.setImage(self.mHelpImageB)
+ else:
+ if not(self.mNHsetted):
+ self.mBHsetted = False
+ self.mNHSetted = True
+ self.mButtonHelp.setRegistrationPointOffset(22, 22)
+ self.mButtonHelp.setImage(self.mHelpImageN)
+
+ if self.mButtonBack.clicked():
+ hs = HallState.CHallState()
+ CGame().setState(hs)
+ hs.setCurrentGame(4)
+ return
+
+ if self.mButtonHelp.clicked():
+ self.mAlphaSet = True
+ self.mHelpShowed = True
+ CGame().addChild(self.mAlpha)
+ CGame().addChild(self.mInstructions)
+ CGame().addChild(self.mButtonAccept)
+ return
+
+ if self.mCurrentState == 0:
+ CGame().addChild(self.mDialogBoy1)
+ CGame().addChild(self.mButtonNext)
+ self.mCurrentState = 1
+
+ if self.mCurrentState < 4:
+ if self.mButtonNext.mouseOver():
+ self.mButtonNext.set_bgColor(OVER_COLOR)
else:
- self.mCurrentState = 3
-
- elif (self.mQuestionAnswered == False):
- if self.mButtonTrue.clicked():
- CGame().removeChild(self.mLabelQuestion)
- CGame().removeChild(self.mButtonTrue)
- CGame().removeChild(self.mButtonFalse)
- if self.mTupleQuestion[1] == True:
- CGame().addChild(self.mDialogGood)
- self.mGood = self.mGood + 1
- self.mPoints.set_goods(self.mGood)
- else:
- CGame().addChild(self.mDialogBad)
- self.mBad = self.mBad + 1
- self.mPoints.set_bads(self.mBad)
- self.mQuestionAnswered = True
- self.time = 0
+ self.mButtonNext.set_bgColor(NORMAL_COLOR)
+
+ if self.mButtonNext.clicked():
+ self.mCurrentState = self.mCurrentState + 1
+
+ if self.mCurrentState == 2:
+ CGame().removeChild(self.mDialogBoy1)
+ CGame().addChild(self.mDialogGirl1)
- elif self.mButtonFalse.clicked():
- CGame().removeChild(self.mLabelQuestion)
- CGame().removeChild(self.mButtonTrue)
- CGame().removeChild(self.mButtonFalse)
- if self.mTupleQuestion[1] == False:
- CGame().addChild(self.mDialogGood)
- self.mGood = self.mGood + 1
- self.mPoints.set_goods(self.mGood)
+ elif self.mCurrentState == 3:
+ CGame().removeChild(self.mButtonNext)
+ CGame().removeChild(self.mDialogGirl1)
+ self.mCurrentState = 4
+
+
+ # Pregunta
+ elif self.mCurrentState == 4:
+ self.time = self.time + 1
+
+ if self.mQuestionShowed == False:
+ if self.next_questionB():
+ CGame().addChild(self.mLabelQuestion)
+ CGame().addChild(self.mButtonTrue)
+ CGame().addChild(self.mButtonFalse)
+ self.mQuestionShowed = True
else:
- CGame().addChild(self.mDialogBad)
- self.mBad = self.mBad + 1
- self.mPoints.set_bads(self.mBad)
- self.mQuestionAnswered = True
- self.time = 0
+ self.mCurrentState = 5
- elif self.mQuestionAnswered == True:
- #self.time = self.mActiveDialog.getTimeState()
- if self.time > 3*30:
- CGame().removeChild(self.mDialogGood)
- CGame().removeChild(self.mDialogBad)
- self.mQuestionShowed = False
- self.mQuestionAnswered = False
- self.mActiveDialog = None
+ elif (self.mQuestionAnswered == False):
+ if self.mButtonTrue.mouseOver():
+ self.mButtonTrue.set_bgColor(OVER_COLOR)
+ else:
+ self.mButtonTrue.set_bgColor(NORMAL_COLOR)
+
+ if self.mButtonFalse.mouseOver():
+ self.mButtonFalse.set_bgColor(OVER_COLOR)
+ else:
+ self.mButtonFalse.set_bgColor(NORMAL_COLOR)
+
+ if self.mButtonTrue.clicked():
+ CGame().removeChild(self.mLabelQuestion)
+ CGame().removeChild(self.mButtonTrue)
+ CGame().removeChild(self.mButtonFalse)
+ self.mButtonTrue.set_bgColor(NORMAL_COLOR)
+ if self.mTupleQuestion[1] == True:
+ CGame().addChild(self.mDialogGood)
+ self.mGood = self.mGood + 1
+ self.mPoints.set_goods(self.mGood)
+ else:
+ CGame().addChild(self.mDialogBad)
+ self.mBad = self.mBad + 1
+ self.mPoints.set_bads(self.mBad)
+ self.mQuestionAnswered = True
+ self.time = 0
+
+ elif self.mButtonFalse.clicked():
+ CGame().removeChild(self.mLabelQuestion)
+ CGame().removeChild(self.mButtonTrue)
+ CGame().removeChild(self.mButtonFalse)
+ self.mButtonFalse.set_bgColor(NORMAL_COLOR)
+ if self.mTupleQuestion[1] == False:
+ CGame().addChild(self.mDialogGood)
+ self.mGood = self.mGood + 1
+ self.mPoints.set_goods(self.mGood)
+ else:
+ CGame().addChild(self.mDialogBad)
+ self.mBad = self.mBad + 1
+ self.mPoints.set_bads(self.mBad)
+ self.mQuestionAnswered = True
+ self.time = 0
+
+ elif self.mQuestionAnswered == True:
+ if self.time > 3*30:
+ CGame().removeChild(self.mDialogGood)
+ CGame().removeChild(self.mDialogBad)
+ self.mQuestionShowed = False
+ self.mQuestionAnswered = False
+ self.mActiveDialog = None
+ if (self.mGood == GOODS) or (self.mBad > BADS):
+ self.mCurrentState = 5
+
+ elif self.mCurrentState == 5:
+
+ self.mAlphaSet = True
+ CGame().addChild(self.mAlpha)
+ msg = _('Has terminado con %s respuestas bien') % self.mGood
+ self.mEndDialog = Globe((450, 100), text=unicode(msg, 'UTF-8'), pico=None)
+ self.mEndDialog.set_center((600, 300))
+ CGame().addChild(self.mEndDialog)
+ CGame().addChild(self.mButtonAccept)
+
+ else:
+ if self.mButtonAccept.mouseOver():
+ self.mButtonAccept.set_bgColor(OVER_COLOR)
+ else:
+ self.mButtonAccept.set_bgColor(NORMAL_COLOR)
+
+ if self.mButtonAccept.clicked():
+ if self.mHelpShowed:
+ self.mAlphaSet = False
+ self.mHelpShowed = False
+ self.mButtonAccept.set_bgColor(NORMAL_COLOR)
+ CGame().removeChild(self.mAlpha)
+ CGame().removeChild(self.mInstructions)
+ CGame().removeChild(self.mButtonAccept)
+ else:
+ hs = HallState.CHallState()
+ CGame().setState(hs)
+ hs.setCurrentGame(4)
+ return
def next_questionB(self):
@@ -240,6 +362,7 @@ class CArea1Game5(CGameState):
CGameState.destroy(self)
CGame().removeChild(self.mButtonBack)
+ CGame().removeChild(self.mButtonHelp)
CGame().removeChild(self.mLabelQuestion)
CGame().removeChild(self.mButtonTrue)
CGame().removeChild(self.mButtonFalse)
@@ -251,6 +374,11 @@ class CArea1Game5(CGameState):
CGame().removeChild(self.mDialogGood)
CGame().removeChild(self.mDialogBad)
CGame().removeChild(self.mPoints)
+ CGame().removeChild(self.mButtonNext)
+ CGame().removeChild(self.mEndDialog)
+ CGame().removeChild(self.mAlpha)
+ CGame().removeChild(self.mInstructions)
+ CGame().removeChild(self.mButtonAccept)
self.mButtonBackA1G5 = None
self.mLabelQuestion = None