Browse files

score layer

  • Loading branch information...
1 parent bd6f510 commit 34ab8f9329427d31179f793aab482f991180f2ed @andrewsmedina committed Aug 25, 2010
Showing with 36 additions and 2 deletions.
  1. +7 −2 jailbreakerz/game.py
  2. +5 −0 jailbreakerz/jailbreakerz.py
  3. +24 −0 jailbreakerz/score.py
View
9 jailbreakerz/game.py
@@ -1,5 +1,3 @@
-import random
-import cocos
from cocos.sprite import *
from cocos.director import director
from cocos.layer import Layer
@@ -10,14 +8,21 @@
from cocos.menu import *
from cocos.text import *
from pyglet import font
+
from actions import *
+
+import score
import pyglet
+import random
+import cocos
class Game(Layer):
def __init__(self):
super(Game, self).__init__()
self.load_sprites()
+
+ score.score_points = 100
def load_sprites(self):
self.prison = Sprite('media/imgs/prison.png')
View
5 jailbreakerz/jailbreakerz.py
@@ -10,6 +10,8 @@
from cocos.text import *
from pyglet import font
+from score import ScoreLayer
+
import pyglet
import sound
@@ -63,6 +65,9 @@ def __init__(self):
def on_start(self):
game_scene = Scene(game.Game(), game.Catcher(), \
game.FallingThief())
+
+ game_scene.add(ScoreLayer(), z=2)
+
director.push( FlipAngular3DTransition(game_scene, 1.5) )
def on_credits(self):
View
24 jailbreakerz/score.py
@@ -0,0 +1,24 @@
+from cocos.layer import *
+from cocos.text import *
+from cocos.actions import *
+
+import pyglet
+from pyglet.gl import *
+
+score_points = 0
+
+class ScoreLayer(Layer):
+ def __init__(self):
+ super(ScoreLayer, self).__init__()
+
+ self.score = Label('score:',
+ font_size=12,
+ color=(255,255,255,255))
+
+ self.position = (700, 580)
+ self.score.position = (0,0)
+ self.add(self.score)
+
+ def draw(self):
+ super(ScoreLayer, self).draw()
+ self.score.element.text = 'Score: %d' % score_points

0 comments on commit 34ab8f9

Please sign in to comment.