diff options
author | Alan Aguiar <alanjas@hotmail.com> | 2012-06-12 06:51:59 (GMT) |
---|---|---|
committer | Alan Aguiar <alanjas@hotmail.com> | 2012-06-12 06:51:59 (GMT) |
commit | d1f0099cfeef0bcaefd1363b0da60bfa06dfcf07 (patch) | |
tree | 7ea1ba63db51fba9d9a420fb89cfe9d02410c902 /src | |
parent | acac7a6d68f01ecbcbbe8d280aff7ff87743a7f5 (diff) |
add points box in a1g1
Diffstat (limited to 'src')
-rw-r--r-- | src/game/Area1Game1.py | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/game/Area1Game1.py b/src/game/Area1Game1.py index 07291a9..1d7f3d0 100644 --- a/src/game/Area1Game1.py +++ b/src/game/Area1Game1.py @@ -3,6 +3,7 @@ import pygame from api.Sprite import CSprite from api.Button import CButton +from api.Points import CPoints from api.Mouse import * @@ -21,6 +22,7 @@ STATE_ADJUST = 2 STATE_RETURN = 3 STATE_OK = 4 + #Piece class hereda de CSprite class Piece(CSprite): @@ -73,10 +75,12 @@ class Piece(CSprite): elif (self.mState == STATE_ADJUST): if (Math.dist(self.mPos.getX() , self.mPos.getY(), self.mDest.getX(), self.mDest.getY()) < self.RADIUS_COLLISION): - + option = self.mParent.mListOptions[self.mNum] CGame().addChild(option) self.setState(STATE_OK) + self.mParent.mGood = self.mParent.mGood + 1 + self.mParent.mPoints.set_goods(self.mParent.mGood) elif (self.mState == STATE_RETURN): @@ -84,6 +88,8 @@ class Piece(CSprite): if (dist < self.RADIUS_COLLISION): #play(Sonido mal) self.setState(STATE_STALE) + self.mParent.mBad = self.mParent.mBad+ 1 + self.mParent.mPoints.set_bads(self.mParent.mBad) elif (self.mState == STATE_OK): pass @@ -142,6 +148,8 @@ class CArea1Game1(CGameState): self.mListOptions = [] self.mListPieces = [] self.mActivePiece = None + self.mBad = 0 + self.mGood = 0 self.mBackground = Image.loadImage('assets/images/a1g1/a1game1.png', False) CGame().setBackground(self.mBackground) @@ -193,6 +201,12 @@ class CArea1Game1(CGameState): self.mOption9.update() self.mListOptions[8] = self.mOption9 + self.mPoints = CPoints() + self.mPoints.setXY(250, 10) + #self.mPoints.set_bads(55) + #self.mPoints.set_goods(55) + + CGame().addChild(self.mPoints) def update(self): #print "menu update" @@ -214,6 +228,8 @@ class CArea1Game1(CGameState): #self.mInstructions.destroy() self.mInstructions = None CGame().removeChild(self.mButtonBackA1G1) + CGame().removeChild(self.mPoints) + self.mPoints = None for p in self.mListPieces: CGame().removeChild(p) |