From fabeaf99d2b4ca6dcdf584dee69d47c50254a3a2 Mon Sep 17 00:00:00 2001 From: Alan Aguiar Date: Tue, 11 Feb 2014 20:59:53 +0000 Subject: save in each game the star state --- (limited to 'src') diff --git a/src/api/Game.py b/src/api/Game.py index 5c65d31..440e260 100644 --- a/src/api/Game.py +++ b/src/api/Game.py @@ -152,10 +152,7 @@ class CGame(object): return self.mPartidaDict[par].getCharacter() def getPartida(self, n): - if self.mPartidaDict.has_key(n): - return self.mPartidaDict[n] - else: - return None + return self.mPartidaDict[n] def getCurrentPartida(self): return self.mCurrentPartida @@ -165,11 +162,10 @@ class CGame(object): def setPartida(self, n, p): self.mPartidaDict[n] = p + + def setEndGameState(self, a, j, s): + self.mPartidaDict[self.mCurrentPartida].setGame(a, j, s) def setBackground(self, aBackgroundImage): self.mBackground = aBackgroundImage - self.blitBackground(self.mBackground) - - def blitBackground(self, aBackgroundImage): self.window.blit(aBackgroundImage, (0, 0)) - diff --git a/src/api/PartidasMan.py b/src/api/PartidasMan.py index d356c56..de78669 100644 --- a/src/api/PartidasMan.py +++ b/src/api/PartidasMan.py @@ -24,6 +24,9 @@ class Partida(object): def getArea(self, n): return self.mAreas[n] + + def setGame(self, a, j, s): + self.mAreas[a][j] = s def getPartidasFromFile(): par = {} diff --git a/src/game/Area1Game1.py b/src/game/Area1Game1.py index 14439cb..660941f 100644 --- a/src/game/Area1Game1.py +++ b/src/game/Area1Game1.py @@ -333,6 +333,8 @@ class CArea1Game1(CGameState): self.mEndDialog.set_center((600, 300)) CGame().addChild(self.mEndDialog) CGame().addChild(self.mButtonAccept) + if (self.mGood == GOODS): + CGame().setEndGameState(1, 0, 1) else: if self.mButtonAccept.mouseOver(): diff --git a/src/game/Area1Game3.py b/src/game/Area1Game3.py index 31a689b..73b87f2 100644 --- a/src/game/Area1Game3.py +++ b/src/game/Area1Game3.py @@ -330,6 +330,8 @@ class CArea1Game3(CGameState): self.mActiveDialog = None if (self.mGood == GOODS) or (self.mBad > BADS): self.mCurrentState = 6 + if (self.mGood == GOODS): + CGame().setEndGameState(1, 2, 1) elif self.mCurrentState == 6: diff --git a/src/game/Area1Game4.py b/src/game/Area1Game4.py index 658b226..a3a7f73 100644 --- a/src/game/Area1Game4.py +++ b/src/game/Area1Game4.py @@ -93,7 +93,7 @@ class CArea1Game4(CGameState): self.mButtonBack.setImage(self.mBackImageN) CGame().addChild(self.mButtonBack) - # help button + # help button self.mHelpImageN = Image.loadImage('assets/images/help.png') self.mHelpImageB = Image.loadImage('assets/images/help_big.png') @@ -236,6 +236,8 @@ class CArea1Game4(CGameState): self.mDialog.set_center((600, 300)) CGame().addChild(self.mDialog) CGame().addChild(self.mButtonAccept) + if (self.mGood == GOODS): + CGame().setEndGameState(1, 3, 1) else: if self.mButtonAccept.mouseOver(): diff --git a/src/game/Area1Game5.py b/src/game/Area1Game5.py index 828f266..7948ec8 100644 --- a/src/game/Area1Game5.py +++ b/src/game/Area1Game5.py @@ -17,7 +17,7 @@ from assets.data import area1game5_data OVER_COLOR = (255, 0, 0) NORMAL_COLOR = (255, 125, 50) -GOODS = 8 +GOODS = 6 BADS = 4 class CArea1Game5(CGameState): @@ -315,6 +315,8 @@ class CArea1Game5(CGameState): self.mActiveDialog = None if (self.mGood == GOODS) or (self.mBad > BADS): self.mCurrentState = 5 + if (self.mGood == GOODS): + CGame().setEndGameState(1, 4, 1) elif self.mCurrentState == 5: diff --git a/src/game/Area1Game6.py b/src/game/Area1Game6.py index d63023c..110f0d5 100644 --- a/src/game/Area1Game6.py +++ b/src/game/Area1Game6.py @@ -41,8 +41,8 @@ WORD7 = [(DX + 350, DY + 0), (DX + 400, DY + 600)] OVER_COLOR = (255, 0, 0) NORMAL_COLOR = (255, 125, 50) -GOODS = 8 -BADS = 4 +GOODS = 18 +BADS = 9 #Piece class hereda de CSprite class Piece(CSprite): @@ -385,6 +385,8 @@ class CArea1Game6(CGameState): self.mEndDialog.set_center((600, 300)) CGame().addChild(self.mEndDialog) CGame().addChild(self.mButtonAccept) + if (self.mGood == GOODS): + CGame().setEndGameState(1, 5, 1) else: if self.mButtonAccept.mouseOver(): @@ -440,8 +442,8 @@ class CArea1Game6(CGameState): piece = None self.mListPieces = None - for help in self.mListHelps: - CGame().removeChild(help) + for h in self.mListHelps: + CGame().removeChild(h) self.mListHelps = None self.mButtonBack = None -- cgit v0.9.1