from esp_hadouken.levels.Level import *
from void.Void import *

class Circulor(Level):

    def __init__(self, parent):
        Level.__init__(self, parent)

    def set_void(self):
        self.void = Void(self)
from random import randint
from operator import sub

from pygame import draw

from esp_hadouken.GameChild import *

class Wave(GameChild):

    def __init__(self, parent, orientation, bottom):
        GameChild.__init__(self, parent)
        self.orientation = orientation
        self.bottom = bottom
        self.edge = 0 if orientation == parent.orient_left else \
                    parent.get_width()
        self.set_base_length()
        self.update()

    def set_base_length(self):
        self.base_length = randint(*self.parent.parent.base_range)

    def get_top(self):
        return self.vertices[0][1]

    def get_bottom(self):
        return self.vertices[1][1]

    def update(self):
        self.bottom += self.parent.parent.scroll_speed
        self.set_height()
        self.set_vertices()
        self.draw()

    def get_pos(self):
        return float(self.bottom) / self.parent.get_height()

    def set_height(self):
        height_r = self.parent.parent.height_range
        self.height = self.get_pos() * -sub(*height_r) + height_r[0]

    def set_vertices(self):
        height = self.height
        edge = self.edge
        base_length = self.base_length
        bottom = self.bottom
        peak_x = height if self.orientation == self.parent.orient_left else \
                 edge - height
        base_top = edge, bottom - base_length
        base_bottom = edge, bottom
        peak = peak_x, bottom - base_length / 2
        self.vertices = base_top, base_bottom, peak

    def draw(self):
        parent = self.parent
        draw.polygon(parent, parent.parent.opaque_color, self.vertices)
from esp_hadouken import levels

from Waves import *

class Void(levels.Void.Void):

    def __init__(self, parent):
        levels.Void.Void.__init__(self, parent)
        self.read_configuration()
        self.waves = Waves(self)

    def read_configuration(self):
        config = self.get_configuration()
        prefix = "circulor-level-"
        self.height_range = config[prefix + "height-range"]
        self.base_range = config[prefix + "base-range"]
        self.scroll_speed = config[prefix + "scroll-speed"]
        self.padding = config[prefix + "void-padding"]

    def update_area(self):
        self.waves.update()
from pygame import Surface, Rect

from esp_hadouken.GameChild import *
from Wave import *

class Waves(GameChild, Surface):

    orient_left, orient_right = range(2)

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

    def init_surface(self):
        parent = self.parent
        width = parent.get_width()
        padding = parent.padding
        bandit_height = parent.parent.bandit.rect.h
        height = parent.get_height() - sum(padding) - bandit_height
        rect = Rect(0, padding[0] + bandit_height, width, height)
        Surface.__init__(self, rect.size)
        self.convert()
        self.rect = rect

    def set_background(self):
        background = Surface(self.get_size())
        background.fill(self.parent.transparent_color)
        background.convert()
        self.background = background

    def generate_waves(self):
        self.waves = waves = []
        while not waves or waves[0].get_bottom() < 0:
            self.add_wave()

    def add_wave(self):
        waves = self.waves
        if not waves:
            bottom = self.get_height()
            orientation = self.orient_right
        else:
            bottom = waves[0].get_top()
            orientation = not waves[0].orientation
        waves.insert(0, Wave(self, orientation, bottom))

    def update(self):
        self.set_clip()
        self.clear()
        self.update_waves()
        self.draw()

    def set_clip(self):
        parent = self.parent
        y = parent.get_clip().top - parent.padding[0] - \
            parent.parent.bandit.rect.h
        Surface.set_clip(self, Rect((0, y), parent.get_clip().size))

    def clear(self):
        self.blit(self.background, (0, 0))

    def update_waves(self):
        waves = self.waves
        if waves[0].get_bottom() > 0:
            self.add_wave()
        for wave in waves:
            if wave.get_top() > self.get_height():
                waves.remove(wave)
            else:
                wave.update()

    def draw(self):
        self.parent.blit(self, self.rect)
from esp_hadouken.pgfw.GameChild import GameChild
from esp_hadouken.overworld.Background import Background
from esp_hadouken.overworld.wall.Wall import Wall
from esp_hadouken.Toy import Toy
from esp_hadouken.dot.Dot import Dot

class Overworld(GameChild):

    def __init__(self, parent):
        GameChild.__init__(self, parent)
        self.display_surface = self.get_display_surface()
        self.delegate = self.get_delegate()
        self.load_configuration()
        self.set_children()
        self.subscribe(self.respond)
        self.place_toy()
        self.reset()
        self.deactivate()

    def load_configuration(self):
        config = self.get_configuration("overworld")
        self.toy_position = config["toy-position"]
        self.audio_path = self.get_resource("overworld", "audio-path")
        self.dot_position = config["dot-position"]

    def set_children(self):
        self.background = Background(self)
        self.toy = Toy(self)
        self.wall = Wall(self)
        self.dot = Dot(self)

    def respond(self, event):
        compare = self.delegate.compare
        if compare(event, "reset-game"):
            self.deactivate()
            self.reset()
        elif compare(event, "main-menu-selection", option="play"):
            self.activate()

    def deactivate(self):
        self.active = False

    def activate(self):
        self.active = True
        self.start_music()

    def start_music(self):
        self.get_audio().play_bgm(self.audio_path)

    def place_toy(self):
        rect = self.toy.rect
        rect.top = self.toy_position
        rect.centerx = self.display_surface.get_rect().centerx

    def reset(self):
        self.place_dot()

    def place_dot(self):
        rect = self.dot.rect
        rect.top = self.dot_position
        rect.centerx = self.display_surface.get_rect().centerx

    def update(self):
        if self.active:
            self.background.update()
            self.toy.update()
            self.wall.update()
            self.dot.update()
34.239.167.149
34.239.167.149
34.239.167.149
 
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!