boost
authorFrank DeMarco <frank.s.demarco@gmail.com>
Sat, 26 Apr 2014 16:51:02 +0000 (01:51 +0900)
committerFrank DeMarco <frank.s.demarco@gmail.com>
Sat, 26 Apr 2014 16:51:02 +0000 (01:51 +0900)
config
scale_sieve/ScaleSieve.py

diff --git a/config b/config
index c71ebf9..5ba6552 100644 (file)
--- a/config
+++ b/config
@@ -9,3 +9,4 @@ volume = C 0.0 0.0, 36.0 0.61, 120.0 1.0
 scale = C 0.0 40.0, 850.0 140.0
 shift-2 = C 0.0 0.0, 840.0 4.2, 2000.0 8.0
 shift = C 0.0 0.0, 500.0 3.5, 1000.0 6.0
 scale = C 0.0 40.0, 850.0 140.0
 shift-2 = C 0.0 0.0, 840.0 4.2, 2000.0 8.0
 shift = C 0.0 0.0, 500.0 3.5, 1000.0 6.0
+boost = L 0.0 0.0, 100.0 4.0
index 9efc7a9..02a2d2e 100644 (file)
@@ -162,7 +162,10 @@ class Triangles(GameChild, list):
         GameChild.__init__(self, parent)
         list.__init__(self, [])
         self.display_surface = self.get_display_surface()
         GameChild.__init__(self, parent)
         list.__init__(self, [])
         self.display_surface = self.get_display_surface()
+        self.delegate = self.get_game().delegate
+        self.booster = Shift(self, 1, "boost")
         self.populate()
         self.populate()
+        self.subscribe(self.respond)
 
     def populate(self):
         if not self:
 
     def populate(self):
         if not self:
@@ -177,8 +180,17 @@ class Triangles(GameChild, list):
     def set_next_gap(self):
         self.next_gap = randint(210, 380)
 
     def set_next_gap(self):
         self.next_gap = randint(210, 380)
 
+    def respond(self, event):
+        compare = self.delegate.compare
+        if compare(event, "down") or compare(event, "down", True):
+            self.booster.active = not event.cancel
+
+    def get_boost(self):
+        return self.booster.get_change()
+
     def update(self):
         self.populate()
     def update(self):
         self.populate()
+        self.booster.update()
         if self[0].location.collidelist(self.parent.sieve.locations) != -1:
             sieve = self.parent.sieve
             if self[0].location.colliderect(sieve.electric.location):
         if self[0].location.collidelist(self.parent.sieve.locations) != -1:
             sieve = self.parent.sieve
             if self[0].location.colliderect(sieve.electric.location):
@@ -225,7 +237,8 @@ class Triangle(Sprite):
         self.location.centerx = self.get_display_surface().get_rect().centerx
 
     def update(self):
         self.location.centerx = self.get_display_surface().get_rect().centerx
 
     def update(self):
-        self.move(dy=2.45 * self.get_game().acid.get_volume() + 1.6)
+        self.move(dy=2.45 * self.get_game().acid.get_volume() + 1.6 + \
+                  self.parent.get_boost())
         for rect in self.collision_rects:
             rect.bottom = self.location.bottom
         Sprite.update(self)
         for rect in self.collision_rects:
             rect.bottom = self.location.bottom
         Sprite.update(self)