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>2012-06-18 02:07:34 (GMT)
committer Alan Aguiar <alanjas@hotmail.com>2012-06-18 02:07:34 (GMT)
commit73b10cf5d4ef9427ff889399a8413c0a668db898 (patch)
treed17e4fe1d4485f79b75226513f4e5c529b982f98 /src
parent5d8ed5bea9a1975428de4acc7f4a88db706e8b47 (diff)
a2g2 works
Diffstat (limited to 'src')
-rw-r--r--src/game/Area2Game2.py92
1 files changed, 83 insertions, 9 deletions
diff --git a/src/game/Area2Game2.py b/src/game/Area2Game2.py
index 59025d1..91d3f31 100644
--- a/src/game/Area2Game2.py
+++ b/src/game/Area2Game2.py
@@ -13,6 +13,11 @@ from api.MultiLabel import CMultiLabel
from api.Points import CPoints
from gettext import gettext as _
+import sys
+sys.path.insert(0, 'assets/data')
+
+import area2game2_data
+
class CArea2Game2(CGameState):
@@ -23,6 +28,10 @@ class CArea2Game2(CGameState):
self.mWheelList = []
self.mCurrentWheel = 0
self.mCurrentState = 0
+ self.mBad = 0
+ self.mGood = 0
+ self.mQuestionShowed = False
+ self.mQuestionAnswered = False
self.mBackground = None
self.mButtonBackA2G2 = None
@@ -60,6 +69,31 @@ class CArea2Game2(CGameState):
self.mButtonStop.set_text(_('Stop'))
CGame().addChild(self.mButtonStop)
+ self.mLabelQuestion = CMultiLabel()
+ #self.mLabelQuestion.set_bgColor((0x99, 0x50, 0x99))
+ #self.mLabelQuestion.font = pygame.font.Font('assets/fonts/DejaVuSans.ttf', 13)
+ self.mLabelQuestion.set_center((600, 500))
+ self.mLabelQuestion.set_size((600, 90))
+
+
+ self.mButtonTrue = CButton()
+ self.mButtonTrue.set_bgColor((0x99, 0x99, 0x66))
+ self.mButtonTrue.font = pygame.font.Font('assets/fonts/DejaVuSans.ttf', 20)
+ self.mButtonTrue.set_center((460, 600))
+ self.mButtonTrue.set_size((200, 40))
+ self.mButtonTrue.set_text(_('Si'))
+
+ self.mButtonFalse = CButton()
+ self.mButtonFalse.set_bgColor((0x99, 0x99, 0x66))
+ self.mButtonFalse.font = pygame.font.Font('assets/fonts/DejaVuSans.ttf', 20)
+ self.mButtonFalse.set_center((740, 600))
+ self.mButtonFalse.set_size((200, 40))
+ self.mButtonFalse.set_text(_('No'))
+
+ self.mPoints = CPoints()
+ self.mPoints.setXY(200, 10)
+ CGame().addChild(self.mPoints)
+
def update(self):
CGameState.update(self)
@@ -71,14 +105,8 @@ class CArea2Game2(CGameState):
CGame().setState(ms)
return
- elif self.mButtonStop.clicked():
- if self.mCurrentState == 0:
- self.mCurrentState = 1
- else:
- self.mCurrentState = 0
-
if self.mCurrentState == 0:
-
+
if self.time > 5:
self.time = 0
CGame().removeChild(self.mWheelList[self.mCurrentWheel])
@@ -89,10 +117,56 @@ class CArea2Game2(CGameState):
self.mCurrentWheel = 0
CGame().addChild(self.mWheelList[self.mCurrentWheel])
+
+ if self.mButtonStop.clicked():
+ self.mCurrentState = 1
elif self.mCurrentState == 1:
- pass
-
+ if self.mQuestionShowed == False:
+ self.mTupleQuestion = area2game2_data.ITEMS[self.mCurrentWheel]
+ self.mLabelQuestion.set_text(self.mTupleQuestion[0])
+ CGame().addChild(self.mLabelQuestion)
+ CGame().addChild(self.mButtonTrue)
+ CGame().addChild(self.mButtonFalse)
+ CGame().removeChild(self.mButtonStop)
+ self.mQuestionShowed = True
+
+ 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:
+ self.mGood = self.mGood + 1
+ self.mPoints.set_goods(self.mGood)
+ else:
+ 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)
+ if self.mTupleQuestion[1] == False:
+ self.mGood = self.mGood + 1
+ self.mPoints.set_goods(self.mGood)
+ else:
+ self.mBad = self.mBad + 1
+ self.mPoints.set_bads(self.mBad)
+ self.mQuestionAnswered = True
+ self.time = 0
+
+ elif self.mQuestionAnswered == True:
+ #self.time = self.mActiveDialog.getTimeState()
+ #if self.time > 4*30:
+ CGame().addChild(self.mButtonStop)
+ self.mQuestionShowed = False
+ self.mQuestionAnswered = False
+ self.time = 0
+ self.mCurrentState = 0
+
def destroy(self):
CGameState.destroy(self)