from os.path import join

from lib.pgfw.pgfw.Sprite import Sprite

class Background(Sprite):

    def __init__(self, parent):
        Sprite.__init__(self, parent)
        self.load_from_path(join(self.get_resource("door", "path"),
                                 str(self.parent.parent.index),
                                 "background.png"), True, True)
        self.location.bottom = self.parent.parent.platforms[0].location.top
        self.reset()

    def reset(self):
        self.location.left = self.parent.foreground.location.right

    def update(self):
        self.move(-self.parent.parent.velocity[0])
        Sprite.update(self)
from os.path import join

from lib.pgfw.pgfw.Sprite import Sprite

class Foreground(Sprite):

    def __init__(self, parent):
        Sprite.__init__(self, parent)
        self.load_configuration()
        index = str(self.parent.parent.index)
        self.load_from_path(self.get_resource(join(self.root, index,
                                                   "foreground.png")), True,
                            True)
        self.location.bottom = self.parent.parent.platforms[0].location.top
        self.reset()

    def reset(self):
        self.location.left = self.x

    def load_configuration(self):
        config = self.get_configuration("door")
        self.x = config["x"]
        self.root = config["path"]

    def update(self):
        self.move(-self.parent.parent.velocity[0])
        Sprite.update(self)
from random import randint, random

from lib.pgfw.pgfw.GameChild import GameChild
from food_spring.level.obstacle.Missile import Missile
from food_spring.level.obstacle.Hurdle import Hurdle
from food_spring.level.obstacle.Spikes import Spikes
from food_spring.level.obstacle.Fireball import Fireball

class Obstacles(GameChild, dict):

    def __init__(self, parent):
        GameChild.__init__(self, parent)
        self.load_configuration()
        self.init_dict()

    def load_configuration(self):
        config = self.get_configuration
        self.missile_chance = config("missile", "chance")
        self.missile_count = config("missile", "count")
        self.blink_rate = config("obstacle", "blink-rate")
        self.hurdle_count = config("hurdle", "count")
        self.hurdle_chance = config("hurdle", "chance")
        self.hurdle_first = config("hurdle", "first-range")
        self.hurdle_margin = config("hurdle", "margin")
        self.spikes_chance = config("spikes", "chance")
        self.fireball_chance = config("fireball", "chance")
        self.fireball_count = config("fireball", "count")

    def init_dict(self):
        missiles = [Missile(self) for _ in xrange(self.missile_count[1])]
        hurdles = [Hurdle(self) for _ in xrange(self.hurdle_count[1])]
        fireballs = [Fireball(self) for _ in xrange(self.fireball_count[1])]
        dict.__init__(self, {"missile": missiles, "spikes": [Spikes(self)],
                             "hurdle": hurdles, "fireball": fireballs})

    def reset(self):
        for obstacle in self.get_obstacles():
            obstacle.reset()

    def get_obstacles(self, exclude=[]):
        if isinstance(exclude, str):
            exclude = [exclude]
        for kind in set(("hurdle", "fireball", "spikes",
                         "missile")).difference(exclude):
            for obstacle in self[kind]:
                yield obstacle

    def update(self):
        if self.parent.is_going():
            self.spawn_missiles()
            self.spawn_hurdles()
            self.spawn_spikes()
            self.spawn_fireballs()
        for obstacle in self.get_obstacles():
            obstacle.update()

    def spawn_missiles(self):
        if all(not missile.is_flying() for missile in self["missile"]):
            if random() < self.missile_chance:
                for ii in xrange(randint(*self.missile_count)):
                    self["missile"][ii].queue_fly()

    def spawn_hurdles(self):
        if all(not hurdle.is_playing(hurdle.enter) and \
               not hurdle.is_playing(hurdle.exit) for \
               hurdle in self["hurdle"]):
            if random() < self.hurdle_chance:
                dy = randint(*self.hurdle_first)
                for ii in xrange(randint(*self.hurdle_count)):
                    self["hurdle"][ii].queue_entrance(dy)
                    dy += randint(*self.hurdle_margin)

    def spawn_spikes(self):
        if not self["spikes"][0].is_playing(self["spikes"][0].slide):
            if random() < self.spikes_chance:
                self["spikes"][0].queue_slide()

    def spawn_fireballs(self):
        if all(not fireball.is_playing(fireball.spew) for fireball in \
               self["fireball"]):
            if random() < self.fireball_chance:
                for ii in xrange(randint(*self.fireball_count)):
                    self["fireball"][ii].queue_spew()
from pygame import Surface

from lib.pgfw.pgfw.Sprite import Sprite

class Hurdle(Sprite):

    def __init__(self, parent):
        Sprite.__init__(self, parent)
        self.load_configuration()
        self.set_frames()
        self.register(self.enter, self.exit)
        self.reset()

    def load_configuration(self):
        config = self.get_configuration("hurdle")
        self.delay = config["delay"]
        self.speed = config["speed"]
        self.pause = config["pause"]

    def set_frames(self):
        surface = Surface((32, 8))
        surface.fill((255, 255, 0))
        self.add_frame(surface, omit=True)
        self.add_frameset(0, name="entered")
        blank = Surface(self.location.size)
        blank.set_colorkey((0, 0, 0))
        self.add_frame(blank, omit=True)
        self.add_frameset([0, 1], self.parent.blink_rate, "queued")

    def reset(self):
        self.halt(self.enter)
        self.halt(self.exit)
        self.active = False
        self.queue_reset = False
        self.location.centerx = self.display_surface.get_rect().left
        self.set_frameset("queued")

    def queue_entrance(self, dy):
        self.location.centery = self.parent.parent.platforms[0].location.top - \
                                dy
        self.active = True
        self.play(self.enter, delay=self.delay)

    def enter(self):
        self.set_frameset("entered")
        self.move(self.speed, 0)
        if self.location.centerx >= self.display_surface.get_rect().centerx:
            self.halt(self.enter)
            self.play(self.exit, delay=self.pause)

    def exit(self):
        self.move(self.speed, 0)
        if self.location.right >= self.display_surface.get_rect().right:
            self.queue_reset = True

    def update(self):
        if self.active:
            if self.is_playing(self.enter, include_delay=True) or \
               self.is_playing(self.exit):
                if self.location.colliderect(self.parent.parent.food):
                    self.parent.parent.food.freeze()
            Sprite.update(self)
        if self.queue_reset:
            self.reset()
3.147.69.132
3.147.69.132
3.147.69.132
 
September 30, 2015


Edge of Life is a form I made with Babycastles and Mouth Arcade for an event in New York called Internet Yami-ichi, a flea market of internet-ish goods. We set up our table to look like a doctor's office and pharmacy and offered free examinations and medication prescriptions, a system described by one person as "a whole pharmacy and medical industrial complex".

Diagnoses were based on responses to the form and observations by our doctor during a short examination. The examination typically involved bizarre questions, toy torpedoes being thrown at people and a plastic bucket over the patient's head. The form combined ideas from Myers-Briggs Type Indicators, Codex Seraphinianus and chain-mail personality tests that tell you which TV show character you are. In our waiting room, we had Lake of Roaches installed in a stuffed bat (GIRP bat). It was really fun!

The icons for the food pyramid are from Maple Story and the gun icons are from the dingbat font Outgunned. I'm also using Outgunned to generate the items in Food Spring.