Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add thief types

  • Loading branch information...
commit f57e7d6136caff86e19267b483ef5826a061e93f 1 parent 2834a78
Flávio Ribeiro flavioribeiro authored
Showing with 26 additions and 8 deletions.
  1. +19 −5 jailbreakerz/actions.py
  2. +7 −3 jailbreakerz/game.py
24 jailbreakerz/actions.py
View
@@ -6,12 +6,25 @@
class CustomJump(IntervalAction):
- def init(self, position, height, jumps, duration):
+ def init(self, thief_type=None):
- self.position = position
- self.height = height
- self.duration = duration
- self.jumps = jumps
+ if thief_type == 'fat':
+ self.position = (500, 0)
+ self.height = 100
+ self.duration = 10
+ self.jumps = 7
+
+ elif thief_type == 'small':
+ self.position = (500, 0)
+ self.height = 100
+ self.duration = 10
+ self.jumps = 7
+
+ elif thief_type == 'tall':
+ self.position = (500, 0)
+ self.height = 100
+ self.duration = 10
+ self.jumps = 7
def start( self ):
self.start_position = self.target.position
@@ -22,6 +35,7 @@ def update(self, t):
y = int(y+self.delta[1] * t)
x = self.delta[0] * t
self.target.position = self.start_position + Point2(x,y)
+ print self.target.position, ':', director.scene.catcher.position
def __reversed__(self):
return CustomJump( (-self.position[0],-self.position[1]), self.height, self.jumps, self.duration)
10 jailbreakerz/game.py
View
@@ -59,14 +59,18 @@ class FallingThief(Layer):
def __init__(self, *args, **kwargs):
super(FallingThief, self).__init__()
- thief_sprites = ['media/imgs/tall_thief.png', 'media/imgs/small_thief.png', 'media/imgs/fat_thief.png']
- self.thief = Sprite(random.sample(thief_sprites, 1)[0])
+ thiefs = {'tall': 'media/imgs/tall_thief.png', \
+ 'small' : 'media/imgs/small_thief.png', \
+ 'fat' : 'media/imgs/fat_thief.png'}
+
+ self.thief_type = random.choice(thiefs)
+ self.thief = Sprite(self.thief_type[1])
self.thief.position = 100, 190
self.add(self.thief)
self.fall()
def fall(self):
- action = CustomJump((500,0), 100, 10, 7)
+ action = CustomJump( self.thief_type[0] )
self.thief.do(action)
pyglet.resource.media('media/sounds/yupi.mp3').play()
Please sign in to comment.
Something went wrong with that request. Please try again.