blink
authorFrank DeMarco <frank.s.demarco@gmail.com>
Tue, 2 Sep 2014 03:03:35 +0000 (12:03 +0900)
committerFrank DeMarco <frank.s.demarco@gmail.com>
Tue, 2 Sep 2014 03:03:57 +0000 (12:03 +0900)
config
resource/img/D2643llleiob/0.png [new file with mode: 0644]
resource/img/D2643llleiob/1.png [new file with mode: 0644]
resource/img/D2643llleiob/2.png [new file with mode: 0644]
shaken_and_spit_out/SSO.py
shaken_and_spit_out/pgfw/Sprite.py

diff --git a/config b/config
index af7765e..eac9e28 100644 (file)
--- a/config
+++ b/config
@@ -31,6 +31,7 @@ character = img/Scraps-ee59-h-Mh/
 background = img/Maltese/
 brick = img/Parasitic-Manure-Crabs.png
 cloud = img/Safire-Translimitter.png
+initializer = img/D2643llleiob/
 
 [text]
 preface = It was a cybernetic adaptation/that allowed it the predilection/to
diff --git a/resource/img/D2643llleiob/0.png b/resource/img/D2643llleiob/0.png
new file mode 100644 (file)
index 0000000..d5aef50
Binary files /dev/null and b/resource/img/D2643llleiob/0.png differ
diff --git a/resource/img/D2643llleiob/1.png b/resource/img/D2643llleiob/1.png
new file mode 100644 (file)
index 0000000..4b547fa
Binary files /dev/null and b/resource/img/D2643llleiob/1.png differ
diff --git a/resource/img/D2643llleiob/2.png b/resource/img/D2643llleiob/2.png
new file mode 100644 (file)
index 0000000..f5c24d7
Binary files /dev/null and b/resource/img/D2643llleiob/2.png differ
index f2747b1..a012de5 100644 (file)
@@ -4,7 +4,7 @@ from random import choice
 from collections import deque
 
 from pygame import cursors, PixelArray, Surface, Color
-from pygame.mouse import set_cursor
+from pygame.mouse import set_cursor, get_pos
 from pygame.font import Font
 from pygame.image import load
 from pygame.draw import polygon, aalines
@@ -65,7 +65,7 @@ class Title(GameChild):
         self.delegate = self.get_delegate()
         self.preface = Preface(self)
         self.preamble = Preamble(self)
-        self.arrow = Arrow(self)
+        self.initializer = Initializer(self)
         self.subscribe(self.respond)
         self.subscribe(self.respond, MOUSEBUTTONDOWN)
         self.deactivate()
@@ -90,7 +90,30 @@ class Title(GameChild):
         if self.active:
             self.preface.update()
             self.preamble.update()
-            self.arrow.update()
+            self.initializer.update()
+
+
+class Initializer(Sprite):
+
+    def __init__(self, parent):
+        Sprite.__init__(self, parent)
+        self.load_from_path(self.get_resource("image", "initializer"),
+                            query="[0-9]*.png", omit=True)
+        self.add_frameset(0, name="waiting")
+        self.add_frameset((0, 2), (1000, 100), "blink")
+        self.set_frameset("waiting")
+        self.location.center = 380, 500
+
+    def update(self):
+        if self.parent.active:
+            mp = get_pos()
+            name = self.get_current_frameset().name
+            if name == "waiting" and self.location.collidepoint(mp):
+                self.set_frameset("blink")
+            elif name == "blink" and not self.location.collidepoint(mp):
+                self.set_frameset("waiting")
+        Sprite.update(self)
+
 
 
 class Preface(GameChild, Surface):
index 5ceb7c5..bd6dd16 100644 (file)
@@ -63,12 +63,12 @@ class Sprite(Animation):
         self.register_interval()
 
     def load_from_path(self, path, transparency=False, ppa=True, key=None,
-                       extension=None, omit=False):
+                       query=None, omit=False):
         if isfile(path):
             paths = [path]
         else:
-            if extension:
-                paths = sorted(glob(join(path, "*." + extension)))
+            if query:
+                paths = sorted(glob(join(path, query)))
             else:
                 paths = [join(path, name) for name in sorted(listdir(path))]
         for path in paths:
@@ -301,7 +301,7 @@ class Fader(Surface):
         self.blit(self.background, (0, 0))
 
 
-class Frameset():
+class Frameset:
 
     def __init__(self, sprite, order=[], framerate=None, name=None):
         self.sprite = sprite