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):


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

    def activate(self, index):

    def update(self):
        for level in self:
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.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):

    def update(self):
        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)

    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(),

    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):

    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 import Mask
from import Plate

class Land(GameChild, Rect):

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

    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.get_initial_top()

    def update(self):
        self.display_surface.blit(self.plate, self)
        self.display_surface.blit(self.mask, self, None, BLEND_RGB_MIN)
June 29, 2013

A few weeks ago, for Fishing Jam, I made a fishing simulation from what was originally designed to be a time attack arcade game. In the program, Dark Stew, the player controls Aphids, an anthropod who fishes for aquatic creatures living in nine pools of black water.

Fishing means waiting by the pool with the line in. The longer you wait before pulling the line out, the more likely a creature will appear. Aside from walking, it's the only interaction in the game. The creatures are drawings of things you maybe could find underwater in a dream.

The background music is a mix of clips from licensed to share songs on the Free Music Archive. Particularly, Seed64 is an album I used a lot of songs from. The full list of music credits is in the game's README file.

I'm still planning to use the original design in a future version. There would be a reaction-based mini game for catching fish, and the goal would be to catch as many fish as possible within the time limit. I also want to add details and obstacles to the background, which is now a little boring, being a plain, tiled, white floor.

If you want to look at all the drawings or hear the music in the context of the program, there are Windows and source versions available. The source should work on any system with Python and Pygame. If it doesn't, bug reports are much appreciated. Comments are also welcome :)

Dark Stew: Windows, Pygame Source

I wrote in my last post that I would be working on an old prototype about searching a cloud for organisms for Fishing Jam. I decided to wait a while before developing that game, tentatively titled Xenographic Barrier. Its main interactive element is a first-person scope/flashlight, so I'd like to make a Wii version of it.

I'm about to start working on a complete version of Ball & Cup. If I make anything interesting for it, I'll post something. There are a lot of other things I want to write about, like game analyses, my new GP2X and arcades in Korea, and there's still music to release. Lots of fun stuff coming!