fade
authorFrank DeMarco <frank.s.demarco@gmail.com>
Sun, 24 Aug 2014 16:55:56 +0000 (01:55 +0900)
committerFrank DeMarco <frank.s.demarco@gmail.com>
Sun, 24 Aug 2014 16:55:56 +0000 (01:55 +0900)
config
resource/img/Scraps-ee59-h-Mh.png [deleted file]
shaken_and_spit_out/SSO.py

diff --git a/config b/config
index 7ce1765..79ea7a7 100644 (file)
--- a/config
+++ b/config
@@ -6,7 +6,7 @@ title = Shaken and Spit Out
 url = http://A-O.in/
 summary = Predict the path of an agitated particle by placing two points
 platform = Linux
-version = 0.1.4
+version = 0.1.0
 init-script = shaken-and-spit-out
 package-root = shaken_and_spit_out
 
@@ -29,6 +29,8 @@ game-over = aud/Amputator.xm
 [image]
 character = img/Scraps-ee59-h-Mh/
 background = img/Maltese/
+brick = img/Parasitic-Manure-Crabs.png
+cloud = img/Safire-Translimitter.png
 
 [text]
 preface = It was a cybernetic adaptation/that allowed it the predilection/to
@@ -36,7 +38,10 @@ preface = It was a cybernetic adaptation/that allowed it the predilection/to
 intermediate = Good something/they that speak in proverbs say/come into the
                city/let it be built/where the flies collect/on a live cadaver in
                the road
-
-[unicode]
+charsets = 0030-0031-0032-0033-0034-0035-0036-0037-0038-0039/2250-2251-2252-
+           2253-2254-2255-2256-2257-2258-2259/2440-2441-2442-2443-2444-2445-
+           2446-2447-2448-2449/235F-2295-2296-2297-2298-2299-229A-229B-229C-
+           229D/22A6-22A7-22A8-22A9-22AA-22AB-22AC-22AD-22AE-22AF/22FF-22F2-
+           22F3-22F5-22F6-22F8-22F9-22FA-22FB-22FD
 
 [interpolate]
diff --git a/resource/img/Scraps-ee59-h-Mh.png b/resource/img/Scraps-ee59-h-Mh.png
deleted file mode 100644 (file)
index 8ca2383..0000000
Binary files a/resource/img/Scraps-ee59-h-Mh.png and /dev/null differ
index 2e04314..d917079 100644 (file)
@@ -2,7 +2,7 @@ from os import listdir
 from glob import glob
 from random import choice
 
-from pygame import cursors
+from pygame import cursors, PixelArray, Surface, Color
 from pygame.mouse import set_cursor
 from pygame.font import Font
 from pygame.image import load
@@ -54,12 +54,16 @@ class Title(GameChild):
 
     def __init__(self, parent):
         GameChild.__init__(self, parent)
+        self.delegate = self.get_delegate()
+        self.preface = Preface(self)
         self.subscribe(self.respond)
         self.subscribe(self.respond, MOUSEBUTTONDOWN)
         self.deactivate()
 
     def respond(self, event):
-        if self.active:
+        if self.delegate.compare(event, "reset-game"):
+            self.activate()
+        elif self.active:
             if event.type == MOUSEBUTTONDOWN and event.button == 1:
                 print "left-click"
 
@@ -68,7 +72,34 @@ class Title(GameChild):
 
     def activate(self):
         self.active = True
+        self.preface.reset()
 
     def update(self):
         if self.active:
-            pass
+            self.preface.update()
+
+
+class Preface(GameChild, Surface):
+
+    def __init__(self, parent):
+        GameChild.__init__(self, parent)
+        ds = self.ds = self.get_display_surface()
+        w, h = ds.get_width(), int(round(ds.get_width() / 1.618))
+        Surface.__init__(self, (w, h), SRCALPHA)
+        self.background = Surface((w, h))
+        self.background.fill((0, 0, 0))
+        mask = self.mask = Surface((w, h), SRCALPHA)
+        pixels = PixelArray(mask)
+        for y in xrange(h):
+            alpha = int(round(255 - (float(y) / h) * 255))
+            for x in xrange(w):
+                pixels[x][y] = Color(255, 255, 255, alpha)
+        del pixels
+
+    def reset(self):
+        pass
+
+    def update(self):
+        self.blit(self.background, (0, 0))
+        self.blit(self.mask, (0, 0), None, BLEND_RGBA_MIN)
+        self.ds.blit(self, (0, 0))