loop
authorFrank DeMarco <frank.s.demarco@gmail.com>
Fri, 25 Apr 2014 21:48:21 +0000 (06:48 +0900)
committerFrank DeMarco <frank.s.demarco@gmail.com>
Fri, 25 Apr 2014 21:48:21 +0000 (06:48 +0900)
scale_sieve/ScaleSieve.py

index 58611cc..7f7f5d4 100644 (file)
@@ -48,12 +48,12 @@ class Strip(Sprite):
             shift.update()
             if shift.time:
                 self.move(shift.get_dx())
-        if self.location.left > 0:
-            self.location.left = 0
-            self.shifts[self.LEFT].time = 0
-        elif self.location.right < self.display_surface.get_width():
-            self.location.right = self.display_surface.get_width()
-            self.shifts[self.RIGHT].time = 0
+        if self.location.left > 0:
+            self.location.left = 0
+            self.shifts[self.LEFT].time = 0
+        elif self.location.right < self.display_surface.get_width():
+            self.location.right = self.display_surface.get_width()
+            self.shifts[self.RIGHT].time = 0
         Sprite.update(self)
 
 
@@ -86,6 +86,7 @@ class Sieve(Strip):
         Strip.__init__(self, parent)
         self.location.center = self.display_surface.get_rect().center
         self.electric = Electric(self)
+        self.add_location(offset=(self.location.w, 0))
 
     def add_frames(self):
         bar_locations = []
@@ -109,6 +110,10 @@ class Sieve(Strip):
             self.add_frame(frame)
 
     def update(self):
+        if self.location.left > 0:
+            self.move(-self.location.w)
+        if self.locations[1].right < self.display_surface.get_width():
+            self.move(self.location.w)
         self.electric.location.centery = self.location.centery
         self.electric.update()
         Strip.update(self)
@@ -135,3 +140,9 @@ class Electric(Sprite):
             del pixels
         for frame in frames:
             self.add_frame(frame)
+
+
+class Triangles(GameChild, list):
+
+    def __init__(self, parent):
+        GameChild.__init__(self, parent)