from lib.pgfw.pgfw.GameChild import GameChild
from food_spring.level.watermelon.Watermelon import Watermelon
from food_spring.level.peach.Peach import Peach
from food_spring.level.pineapple.Pineapple import Pineapple
from food_spring.level.grapes.Grapes import Grapes

class Levels(GameChild, list):

    WATERMELON, PEACH, GRAPES, PINEAPPLE = range(4)

    def __init__(self, parent):
        GameChild.__init__(self, parent)
        list.__init__(self, (Watermelon(self), Peach(self), Grapes(self),
                             Pineapple(self)))

    def activate(self, index):
        self[index].activate()

    def update(self):
        for level in self:
            level.update()
from random import randrange, choice

from pygame import Surface, PixelArray, Color
from pygame.image import load, save
from pygame.locals import *

from lib.pgfw.pgfw.Animation import Animation

class Window(Animation):

    def __init__(self, parent):
        Animation.__init__(self, parent)
        self.display_surface = self.get_display_surface()
        self.load_configuration()
        self.set_images()
        self.set_x_range()
        self.alpha_ratio = randrange(100) * .01
        self.alpha_direction = choice((1, -1))

    def load_configuration(self):
        config = self.get_configuration("window")
        self.alpha = config["alpha"]
        self.remain_length = config["remain-length"]
        self.fade_step = config["fade-step"]
        self.margin = config["margin"]

    def set_images(self):
        image = load(self.get_resource("window", "path")).convert()
        inverted = Surface(image.get_size())
        inverted.fill((255, 255, 255))
        inverted.blit(image, (0, 0), None, BLEND_SUB)
        pixels = PixelArray(inverted)
        for x in xrange(len(pixels) - 1):
            for y in xrange(len(pixels[x]) - 1):
                color = Color(*image.unmap_rgb(pixels[x][y]))
                hue, saturation, value, alpha = color.hsva
                color.hsva = hue, saturation, 100 - value, alpha
                pixels[x][y] = color
        del pixels
        self.images = image, inverted
        self.rect = image.get_rect()
        self.rect.right = self.display_surface.get_rect().right - self.margin

    def set_x_range(self):
        margin = self.margin
        self.x_range = margin, \
                       self.display_surface.get_width() - margin - self.rect.w

    def reset(self):
        pass

    def update(self):
        Animation.update(self)
        self.update_alpha()
        intermediate = Surface(self.rect.size)
        intermediate.blit(self.images[0], (0, 0))
        intermediate.blit(self.images[1], (0, 0))
        self.display_surface.blit(intermediate, self.rect, None, BLEND_MAX)

    def update_alpha(self):
        self.alpha_ratio += self.fade_step * self.alpha_direction
        if self.alpha_ratio < 0:
            self.alpha_ratio = 0
            self.alpha_direction = 1
        elif self.alpha_ratio > 1:
            self.alpha_ratio = 1
            self.alpha_direction = -1
        alpha = self.alpha
        self.images[0].set_alpha(int(alpha * self.alpha_ratio))
        self.images[1].set_alpha(int(alpha * (1 - self.alpha_ratio)))
from food_spring.level.Level import Level

class Peach(Level):

    def __init__(self, parent):
        Level.__init__(self, parent, parent.PEACH)
from food_spring.level.Level import Level

class Grapes(Level):

    def __init__(self, parent):
        Level.__init__(self, parent, parent.GRAPES)
from pygame import Surface, Color

from lib.pgfw.pgfw.GameChild import GameChild

class Plate(GameChild, Surface):

    def __init__(self, parent):
        GameChild.__init__(self, parent)
        self.load_configuration()
        self.init_surface()
        self.set_background()

    def load_configuration(self):
        config = self.get_configuration("land")
        self.height = config["height"]
        self.speed = config["fade-speed"]

    def init_surface(self):
        Surface.__init__(self, (self.get_display_surface().get_width(),
                                self.height))

    def set_background(self):
        width, height = self.get_size()
        background = Surface((width, height))
        color = Color(0, 0, 0)
        for y in xrange(height):
            hue = int(float(y) / (height) * 360)
            color.hsva = hue, 100, 100, 100
            background.fill(color, (0, y, width, 1))
        self.background = background

    def reset(self):
        self.offset = 0

    def update(self):
        self.update_offset()
        self.draw()

    def update_offset(self):
        offset = self.offset - self.speed
        height = self.get_height()
        if offset < -height:
            offset += height
        self.offset = offset

    def draw(self):
        offset = int(self.offset)
        background = self.background
        self.blit(background, (0, offset))
        self.blit(background, (0, offset + self.get_height()))
from pygame import Rect
from pygame.locals import *

from lib.pgfw.pgfw.GameChild import GameChild
from food_spring.level.land.Mask import Mask
from food_spring.level.land.Plate import Plate

class Land(GameChild, Rect):

    def __init__(self, parent):
        GameChild.__init__(self, parent)
        self.load_configuration()
        self.mask = Mask(self)
        self.plate = Plate(self)
        self.display_surface = self.get_display_surface()
        self.init_rect()
        self.reset()

    def load_configuration(self):
        config = self.get_configuration("land")
        self.height = config["height"]
        self.altitude_ratio = config["altitude-ratio"]

    def init_rect(self):
        Rect.__init__(self, (0, self.get_initial_top()), self.mask.get_size())

    def get_initial_top(self):
        return self.display_surface.get_height() - self.h

    def reset(self):
        self.top = self.get_initial_top()
        self.mask.reset()
        self.plate.reset()

    def update(self):
        self.mask.update()
        self.plate.update()
        self.display_surface.blit(self.plate, self)
        self.display_surface.blit(self.mask, self, None, BLEND_RGB_MIN)
44.211.31.134
44.211.31.134
44.211.31.134
 
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.