This commit is contained in:
Frank DeMarco 2014-04-26 11:11:52 +09:00
parent db2b1d2840
commit f9836a1ef8
2 changed files with 26 additions and 10 deletions

2
config
View File

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

View File

@ -1,4 +1,4 @@
from random import randint
from random import randint, randrange, choice
from pygame import Surface, PixelArray
@ -96,13 +96,12 @@ class Sieve(Strip):
bar_locations = []
x = 0
nodeset = self.get_game().interpolator.get_nodeset("scale")
bar_w = 3
self.bar_w = bar_w = 3
self.gaps = gaps = []
while x < nodeset[-1].x:
bar_locations.append(x)
step = nodeset.get_y(x, natural=True)
gaps.append(step - bar_w)
x += step
gaps.append(nodeset.get_y(x, natural=True))
x += gaps[-1]
surface = Surface((x, 30))
transparent_color = (255, 0, 255)
surface.fill(transparent_color)
@ -158,7 +157,7 @@ class Triangles(GameChild, list):
self.set_next_gap()
def set_next_gap(self):
self.next_gap = randint(30, 56)
self.next_gap = randint(128, 512)
def update(self):
if not self or self[-1].location.top > self.next_gap:
@ -174,10 +173,27 @@ class Triangle(Sprite):
def __init__(self, parent):
Sprite.__init__(self, parent)
surface = Surface((100, 20))
surface.fill((69, 178, 220))
mark = randint(64, 256)
sieve = self.parent.parent.sieve
gaps = sieve.gaps
start = randrange(0, len(gaps))
widths = [gaps[start]]
while sum(widths) < mark:
widths.append(gaps[(start + len(widths)) % len(gaps)])
surface = Surface((sum(widths), 20))
transparent_color = (255, 0, 255)
surface.fill(transparent_color)
surface.set_colorkey(transparent_color)
x = 0
margin = 6
for width in widths:
surface.fill((102, 82, 99), (x + sieve.bar_w + margin / 2, 0,
width - sieve.bar_w - margin,
surface.get_height()))
x += width
self.add_frame(surface)
self.location.centerx = self.get_display_surface().get_rect().centerx
def update(self):
self.move(dy=8)
self.move(dy=1)
Sprite.update(self)