from random import choice, randrange

from pygame import Surface
from pygame.mixer import Sound

from _send.pgfw.Sprite import Sprite
from _send.Send import SoundEffect

class Cup(Sprite):

    def __init__(self, parent):
        Sprite.__init__(self, parent)
        self.display_surface = self.get_display_surface()
        self.set_frame()
        self.set_color()
        self.direction = choice((1, -1))
        self.moving = True
        self.wall_audio = SoundEffect(self.get_resource("cup", "wall-audio"),
                                      .8)

    def set_frame(self):
        size = self.get_size()
        surface = Surface((size, size))
        self.add_frame(surface)
        self.place()
        self.align()

    def get_size(self):
        return self.parent.cup_scale * self.display_surface.get_height() * \
               (1 - self.get_configuration("sideline", "proportion") * 2)

    def place(self):
        sidelines = self.parent.parent.sidelines
        self.rect.top = randrange(sidelines[0].bottom,
                                  sidelines[1].top - self.rect.h)

    def align(self):
        self.rect.right = self.display_surface.get_rect().right

    def set_color(self):
        self.color = self.parent.get_foreground_color()
        self.paint()

    def paint(self):
        self.get_current_frame().fill(self.color)

    def stop(self):
        self.moving = False

    def update(self):
        if self.moving:
            self.move(dy=self.parent.speed * self.direction)
            self.collide()
        Sprite.update(self)

    def collide(self):
        for sideline in self.parent.parent.sidelines:
            if self.location.colliderect(sideline):
                self.direction *= -1
                self.move(dy=sideline.clip(self.location).h * self.direction)
                self.wall_audio.play()
from pygame import Color, Surface, Rect
from pygame.time import get_ticks
from pygame.draw import circle
from pygame.mixer import Sound

from _send.pgfw.GameChild import GameChild
from _send.Send import SoundEffect

class Charge(GameChild):

    def __init__(self, parent):
        GameChild.__init__(self, parent)
        self.delegate = self.get_game().delegate
        self.display_surface = self.get_display_surface()
        self.charging_audio = SoundEffect(self.get_resource("charge",
                                                            "charging-audio"),
                                          .55)
        self.send_audio = SoundEffect(self.get_resource("charge",
                                                        "send-audio"), .1)
        self.load_configuration()
        self.subscribe(self.respond)
        self.reset()

    def load_configuration(self):
        config = self.get_configuration("charge")
        self.transparent_color = Color(*config["transparent-color"])
        self.colors = tuple(Color(color + "ff") for color in config["colors"])
        self.peak_time = config["peak-time"]
        self.size_limits = config["size-limits"]
        self.margin = config["margin"]

    def respond(self, event):
        fields = self.parent
        if not fields.loading and not fields.suppressing_input and \
               fields.get_current_field():
            if not self.sent and self.delegate.compare(event, "charge"):
                self.charging = True
                self.start = get_ticks()
            elif self.charging and self.delegate.compare(event, "charge", True):
                self.sent = True
                self.charging = False
                self.parent.get_current_field().ball.launch(self.get_strength())
                self.send_audio.play()

    def reset(self):
        self.charging = False
        self.start = None
        self.sent = False
        self.color_index = 0
        self.last_strength = None

    def get_strength(self):
        return float((get_ticks() - self.start) % self.peak_time) / \
               self.peak_time

    def update(self):
        if not self.sent and self.charging:
            self.increment_color_index()
            lower, upper = 4, 150
            if self.last_strength is None or \
                   self.last_strength > self.get_strength():
                self.charging_audio.play()
            strength = self.last_strength = self.get_strength()
            width = strength * (upper - lower) + lower
            lower, upper = 1, 22
            height = strength * (upper - lower) + lower
            rect = Rect(0, 0, width, height)
            rect.midbottom = self.parent.sidelines[1].midtop
            self.display_surface.fill(self.get_color(), rect)

    def increment_color_index(self):
        self.color_index += 1
        if self.color_index == len(self.colors):
            self.color_index = 0

    def get_color(self):
        return self.colors[self.color_index]
from pygame import Surface
from pygame.mixer import Sound

from _send.pgfw.Sprite import Sprite
from _send.Send import SoundEffect

class Ball(Sprite):

    def __init__(self, parent):
        Sprite.__init__(self, parent)
        self.display_surface = self.get_display_surface()
        self.set_frame()
        self.set_color()
        self.adjust_for_size()
        self.reset()
        self.reflect_audio = SoundEffect(self.get_resource("ball",
                                                           "reflect-audio"),
                                         .35)

    def set_frame(self):
        size = self.get_size()
        surface = Surface((size, size))
        self.add_frame(surface)
        self.center()

    def get_size(self):
        return self.parent.ball_scale * self.display_surface.get_height() * \
               (1 - self.get_configuration("sideline", "proportion") * 2)

    def center(self):
        self.rect.centery = self.display_surface.get_rect().centery

    def set_color(self):
        self.color = self.parent.get_foreground_color()
        self.paint()

    def paint(self):
        self.get_current_frame().fill(self.color)

    def adjust_for_size(self):
        lower, upper = self.get_configuration("ball", "base-velocity-range")
        ratio = self.rect.w / float(self.get_configuration("ball", "base-size"))
        self.velocity_range = ratio * lower, ratio * upper
        self.deceleration = ratio * self.get_configuration("ball",
                                                           "base-deceleration")

    def reset(self):
        self.velocity = 0

    def launch(self, strength):
        lower, upper = self.velocity_range
        self.velocity = strength * (upper - lower) + lower
        self.direction = 1

    def update(self):
        if self.velocity:
            self.move(self.velocity * self.direction)
            if self.rect.right >= self.display_surface.get_rect().right:
                self.direction = -1
                self.move(self.display_surface.get_rect().right - \
                          self.rect.right)
                self.reflect_audio.play()
            self.velocity -= self.deceleration
            if self.velocity < 1 or self.rect.right < 0:
                self.velocity = 0
                self.parent.cup.stop()
                self.parent.parent.result.evaluate()
        Sprite.update(self)
        if self.rect.colliderect(self.parent.cup.location):
            self.display_surface.fill(self.parent.get_background_color(),
                                      self.rect.clip(self.parent.cup.location))
216.73.216.116
216.73.216.116
216.73.216.116
 
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.