This commit is contained in:
Frank DeMarco 2014-04-26 16:18:46 +09:00
parent 1252cfeaed
commit 143791ae23
2 changed files with 24 additions and 10 deletions

4
config
View File

@ -5,6 +5,6 @@ dimensions = 420, 700
quit = K_ESCAPE
[interpolate]
scale = C 0.0 20.0, 850.0 110.0
shift = C 0.0 0.0, 1300.0 4.7, 2000.0 6.0
scale = C 0.0 24.0, 850.0 110.0
shift = C 0.0 0.0, 500.0 3.5, 1000.0 6.0
shift-2 = C 0.0 0.0, 840.0 4.2, 2000.0 8.0

View File

@ -91,6 +91,8 @@ class Sieve(Strip):
self.vshifts = Shift(self, -1, "shift"), Shift(self, 1, "shift")
self.electric = Electric(self)
self.add_location(offset=(self.location.w, 0))
for location in self.locations:
location.bottom = self.parent.acid.ry[1]
def add_frames(self):
bar_locations = []
@ -134,7 +136,7 @@ class Sieve(Strip):
if shift.time:
self.move(dy=shift.get_change())
acid = self.parent.acid
if self.location.top < acid.ry[0]:
if self.location.bottom < acid.ry[0]:
self.vshifts[self.UP].time = 0
for location in self.locations:
location.top = acid.ry[0]
@ -175,15 +177,24 @@ class Triangles(GameChild, list):
def __init__(self, parent):
GameChild.__init__(self, parent)
list.__init__(self, [])
self.set_next_gap()
self.display_surface = self.get_display_surface()
self.populate()
def populate(self):
if not self:
self.append(Triangle(self))
self[-1].location.bottom = 0
self.set_next_gap()
while self[-1].location.top > -self.display_surface.get_height():
self.append(Triangle(self))
self[-1].location.bottom = self[-2].location.top - self.next_gap
self.set_next_gap()
def set_next_gap(self):
self.next_gap = randint(128, 512)
self.next_gap = randint(128, 382)
def update(self):
if not self or self[-1].location.top > self.next_gap:
self.append(Triangle(self))
self.set_next_gap()
self.populate()
if self[0].location.collidelist(self.parent.sieve.locations) != -1:
self.remove(self[0])
for triangle in self:
@ -205,7 +216,7 @@ class Triangle(Sprite):
surface.set_colorkey((0, 0, 0))
x = 0
height = surface.get_height()
margin = 10
margin = 12
for width in widths:
x += sieve.bar_w
points = (x + margin / 2, height - 2), \
@ -217,7 +228,10 @@ class Triangle(Sprite):
self.location.centerx = self.get_display_surface().get_rect().centerx
def update(self):
self.move(dy=1)
acid = self.get_game().acid
ratio = 1 - (self.get_game().sieve.location.bottom - acid.ry[0]) / \
float(acid.ry[1] - acid.ry[0])
self.move(dy=3 * ratio + .5)
Sprite.update(self)