from esp_hadouken.pgfw.GameChild import GameChild
from esp_hadouken.title.background.Sky import Sky
from esp_hadouken.title.background.Mask import Mask

class Background(GameChild):

    def __init__(self, parent):
        GameChild.__init__(self, parent)
        self.sky = Sky(self)
        self.mask = Mask(self)

    def update(self):
        self.sky.update()
        self.mask.update()
from pygame import Surface, Color, PixelArray
from pygame.image import load

from esp_hadouken.pgfw.GameChild import GameChild

class Mask(Surface, GameChild):

    def __init__(self, parent):
        GameChild.__init__(self, parent)
        self.display_surface = self.get_screen()
        self.transparent_color = 0xFF00FF
        self.load_configuration()
        self.init_surface()
        self.modify()

    def init_surface(self):
        Surface.__init__(self, self.display_surface.get_size())
        self.set_colorkey(self.transparent_color)
        self.blit(load(self.vector_path).convert(), (0, 0))

    def load_configuration(self):
        get = self.get_resource
        config = self.get_configuration("title")
        self.vector_path = get("title", "mask-vector-path")
        self.vector_color = Color(config["mask-vector-colors"][2])
        self.foreground_path = get("title", "mask-foreground-path")

    def modify(self):
        pixels = PixelArray(self)
        white = 0xFFFFFF
        pixels.replace(white, self.vector_color)
        reference = PixelArray(load(self.foreground_path).convert())
        for ii, column in enumerate(reference):
            for jj, pixel in enumerate(column):
                if pixel == 0xFFFFFF:
                    pixels[ii][jj] = self.transparent_color

    def update(self):
        self.draw()

    def draw(self):
        self.display_surface.blit(self, (0, 0))
from random import choice

from pygame import Color, PixelArray

from esp_hadouken.pgfw.GameChild import GameChild

class Blinker(GameChild):

    def __init__(self, parent, initial_freq, max_freq):
        GameChild.__init__(self, parent)
        self.frequency = initial_freq
        self.max_freq = max_freq
        self.iterations = 0
        self.set_palettes()

    def set_palettes(self):
        config = self.get_configuration("sprite")
        self.inner_palette = map(
            self.translate_hex_color, config["inner-palette"])
        self.outer_palette = map(
            self.translate_hex_color, config["outer-palette"])
        self.palette = (Color("black"), Color("white"))

    def translate_hex_color(self, color):
        return Color(color + "ff")

    def build_palette(self):
        return (choice(self.inner_palette), choice(self.outer_palette))

    def paint(self):
        image = self.parent.image
        pixels = PixelArray(image)
        old_palette = self.palette
        new_palette = self.build_palette()
        pixels.replace(old_palette[0], new_palette[0])
        pixels.replace(old_palette[1], new_palette[1])
        self.palette = new_palette
        image.unlock()

    def blink(self):
        iterations = self.iterations + 1
        if 1.0 / iterations <= self.frequency:
            self.paint()
            iterations = 0
        self.iterations = iterations
from math import floor
import copy

import pygame

from esp_hadouken.sprite.Blinker import Blinker
from esp_hadouken.pgfw.GameChild import GameChild

class Sprite(GameChild):

    def __init__(self, parent, image_path, display_surface, bounds=(None, None),
                 wrap=(False, False), initial_blink_freq=0, max_blink_freq=1):
        GameChild.__init__(self, parent)
        self.image_path = image_path
        self.display_surface = display_surface
        self.bounds = bounds
        self.wrap = wrap
        self.restricted_areas = []
        self.blinker = Blinker(self, initial_blink_freq, max_blink_freq)
        self.add_image()
        self.hide()

    def add_image(self):
        image = pygame.image.load(self.image_path).convert_alpha()
        self.rect = image.get_rect()
        self.old_rect = self.rect
        self.image = image

    def paint(self):
        self.blinker.paint()

    def move(self, x=0, y=0):
        self.old_rect = copy.copy(self.rect)
        if isinstance(x, tuple) or isinstance(x, list):
            x, y = x[0], x[1]
        if x < 0:
            x = floor(x)
        if y < 0:
            y = floor(y)
        rect = self.rect
        self.place(rect.left + x, rect.top + y)
        self.rect = self.accommodate_wrapping(rect)

    def place(self, x=None, y=None):
        rect = self.rect
        if type(x) is tuple or type(x) is list:
            x, y = x[0], x[1]
        if x is None:
            x = rect.left
        if y is None:
            y = rect.top
        self.rect.topleft = x, y

    def accommodate_wrapping(self, rect):
        horizontal, vertical = self.wrap
        scope = self.display_surface.get_rect()
        if vertical:
            if rect.top < -rect.h:
                rect.top += scope.h
            elif rect.top > scope.h:
                rect.top -= scope.h
        if horizontal:
            if rect.left < 0:
                rect.left += scope.w - rect.w - 1
            elif rect.right > scope.w:
                rect.right -= scope.w - rect.w - 1
        return rect

    def add_restricted_areas(self, rects):
        if type(rects) is not list:
            rects = [rects]
        self.restricted_areas += rects

    def flip(self):
        self.image = pygame.transform.flip(self.image, True, False)

    def resize(self, size):
        self.image = pygame.transform.scale(self.image, size)

    def show(self):
        self.visible = True

    def hide(self):
        self.visible = False

    def set_blink_frequency(self, frequency):
        self.blinker.frequency = frequency

    def update(self):
        if self.visible:
            self.blinker.blink()
            self.draw()

    def draw(self):
        self.display_surface.blit(self.image, self.rect)

    def erase(self):
        self.parent.clear(self.old_rect)
216.73.216.127
216.73.216.127
216.73.216.127
 
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.