This commit is contained in:
Frank DeMarco 2014-04-27 21:58:48 +09:00
parent a3bb42751d
commit d28cea3c0a
3 changed files with 77 additions and 18 deletions

22
README
View File

@ -1,18 +1,22 @@
-----------
Scale Sieve
-----------
==============
Electric Sieve
==============
Split the triangles without touching them. Go up to make the
triangles come faster.
Avoid touching the triangles with the rods. Chain successes to send
acid deeper into the Earth.
Controls
````````
L/R --- Scroll sieve
Down -- Increase fall speed
F11 --- Full screen
Requirements
------------
````````````
Windows ---- none
Linux/Mac -- Python 2.6+, Pygame 1.8.1+
Running
-------
```````
Windows ---- double-click "scale-sieve" EXE
Linux/Mac -- run "./scale-sieve" on the command line

9
config
View File

@ -5,8 +5,9 @@ dimensions = 420, 700
quit = K_ESCAPE
[interpolate]
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
volume = C 0.0 0.0, 16.0 0.61, 80.0 1.0
scale = C 0.0 40.0, 400.0 140.0
shift-2 = C 0.0 0.0, 210.0 4.2, 500.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
boost = L 0.0 0.0, 100.0 6.0
intensity = C 0.0 0.15, 10000 0.3, 25000 0.4

View File

@ -20,11 +20,13 @@ class ScaleSieve(Game):
self.acid = Acid(self)
self.sieve = Sieve(self)
self.triangles = Triangles(self)
self.static = Static(self)
def update(self):
self.display.screen.blit(self.background, (0, 0))
self.triangles.update()
self.sieve.update()
self.static.update()
class Strip(Sprite):
@ -35,7 +37,7 @@ class Strip(Sprite):
Sprite.__init__(self, parent)
self.display_surface = self.get_display_surface()
self.delegate = self.get_game().delegate
self.hshifts = Shift(self, -1, "shift-2"), Shift(self, 1, "shift-2")
self.hshifts = Shift(self, 1, "shift-2"), Shift(self, -1, "shift-2")
self.add_frames()
self.subscribe(self.respond)
@ -88,7 +90,6 @@ class Sieve(Strip):
Strip.__init__(self, parent)
self.delegate = self.get_game().delegate
self.location.center = self.display_surface.get_rect().center
self.vshifts = Shift(self, -1, "shift"), Shift(self, 1, "shift")
self.electric = Electric(self)
self.add_location(offset=(self.location.w, 0))
@ -178,7 +179,7 @@ class Triangles(GameChild, list):
self.set_next_gap()
def set_next_gap(self):
self.next_gap = randint(210, 380)
self.next_gap = randint(500, 800)
def respond(self, event):
compare = self.delegate.compare
@ -203,6 +204,7 @@ class Triangles(GameChild, list):
0)).colliderect(br.move((sieve.location.left,
0))):
self.remove(self[0])
self.parent.static.increase()
break
for triangle in self:
triangle.update()
@ -212,7 +214,7 @@ class Triangle(Sprite):
def __init__(self, parent):
Sprite.__init__(self, parent)
mark = randint(96, 328)
mark = randint(112, 328)
sieve = self.parent.parent.sieve
gaps = sieve.gaps
start = randrange(0, len(gaps))
@ -237,7 +239,7 @@ class Triangle(Sprite):
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=5.5 * self.get_game().acid.get_volume() + 3.8 + \
self.parent.get_boost())
for rect in self.collision_rects:
rect.bottom = self.location.bottom
@ -265,3 +267,55 @@ class Acid(GameChild):
def increase(self):
self.substance += 1
class Static(Sprite):
def __init__(self, parent):
Sprite.__init__(self, parent)
self.add_frames()
self.intensity = 0
self.increaser = Shift(self, 1, "intensity")
def add_frames(self):
surface = Surface(self.get_display_surface().get_size())
frames = surface, surface.copy(), surface.copy(), surface.copy()
tiles = []
for _ in xrange(32):
tiles.append(Surface((16, 16)))
pixel_arrays = []
for tile in tiles:
pixel_arrays.append(PixelArray(tile))
# colors = (0, 0, 0), (128, 128, 128), (198, 128, 255), (255, 255, 255)
colors = (0, 0, 0), (64, 64, 64), (128, 128, 128), (196, 196, 196), \
(255, 255, 255)
for x in xrange(len(pixel_arrays[0])):
for y in xrange(len(pixel_arrays[0][0])):
for pixels in pixel_arrays:
pixels[x][y] = choice(colors)
for pixels in pixel_arrays:
del pixels
del pixel_arrays
for frame in frames:
for y in xrange(0, frame.get_height(), tiles[0].get_height()):
for x in xrange(0, frame.get_width(), tiles[0].get_width()):
frame.blit(choice(tiles), (x, y))
self.add_frame(frame)
def increase(self):
self.intensity += self.increaser.get_change()
print self.increaser.get_change()
if self.intensity > 1:
self.intensity = 1
self.increaser.time += 12000
if self.increaser.time >= self.increaser.nodeset[-1].x + 5000:
self.increaser.time = self.increaser.nodeset[-1].x + 5000
def update(self):
self.set_alpha(int(self.intensity * 255))
if self.intensity >= .65:
print "game over"
if self.intensity > 0:
self.intensity *= .998
self.increaser.update()
Sprite.update(self)