from random import randrange
from os import listdir
from os.path import join

from pygame import image

from xenographic_wall.pgfw.GameChild import GameChild
from xenographic_wall.world.mushrooms.Mushroom import Mushroom

class Mushrooms(GameChild, list):

    def __init__(self, parent):
        GameChild.__init__(self, parent)
        self.subscribe_to(self.get_custom_event_id(), self.respond_to_event)
        self.load_images()
        self.reset()

    def respond_to_event(self, evt):
        if self.is_command(evt, "reset-game"):
            self.reset()

    def load_images(self):
        images = []
        root = self.get_resource("mushrooms", "path")
        files = self.get_configuration("mushrooms", "images")
        for path in listdir(root):
            parent = join(root, path)
            images.append(
                (image.load(join(parent, files[0])).convert_alpha(),
                 image.load(join(parent, files[1])).convert_alpha()))
        self.images = images

    def reset(self):
        self.populate()

    def populate(self):
        images = self.images
        count = self.get_configuration().get("mushrooms", "count")
        group_count = len(images)
        list.__init__(self, [[] for _ in range(group_count)])
        for ii in range(count):
            self.add_mushroom(ii % group_count)

    def add_mushroom(self, group):
        mushroom = Mushroom(self, group, self.images[group])
        self[group].append(mushroom)
        return mushroom

    def replace_mushroom(self, mushroom):
        group = mushroom.group
        self[group].remove(mushroom)
        self.add_mushroom(group)

    def update(self):
        for group in self:
            for mushroom in group:
                mushroom.update()
from time import time
from collections import deque

from pygame import Surface, Color, mouse, draw

from xenographic_wall.pgfw.GameChild import *
from xenographic_wall.world.scope.chain.Chain import Chain

class Scope(GameChild):

    transparent_color = Color("magenta")

    def __init__(self, parent):
        GameChild.__init__(self, parent)
        self.subscribe_to(self.get_custom_event_id(), self.respond_to_event)
        self.chain = Chain(self)
        self.deactivate()
        self.reset()

    def activate(self):
        self.active = True

    def deactivate(self):
        self.active = False

    def respond_to_event(self, evt):
        if self.active:
            is_command = self.is_command
            if is_command(evt, "mouse-down-left"):
                self.respond_to_set()
            if is_command(evt, "mouse-down-right"):
                self.respond_to_set_and_reel()
            if is_command(evt, "reel"):
                self.respond_to_reel()

    def respond_to_set(self):
        if not self.flash_start:
            self.place()

    def hide(self):
        self.chain.hide()

    def collide_click(self):
        return self.chain.collidepoint(self.parent.get_mouse_pos())

    def respond_to_set_and_reel(self):
        if not self.flash_start:
            if self.chain.is_hidden() or not self.collide_click():
                self.place()
            self.activate_flash()

    def place(self):
        self.chain.place(self.parent.get_mouse_pos())

    def activate_flash(self):
        self.flash_start = time()
        self.chain.set_color_to_flash()
#         self.show()

    def show(self):
        self.chain.show()

    def respond_to_reel(self):
        self.activate_flash()

    def reset(self):
        chain = self.chain
        chain.reset()
        self.deactivate_flash()
        chain.hide()

    def deactivate_flash(self):
        self.flash_start = None
        self.chain.set_color_to_default()

    def update(self):
        if self.active:
            self.update_flash()
            self.chain.update()

    def update_flash(self):
        start = self.flash_start
        config = self.get_configuration().get_section("scope")
        chain = self.chain
        if start:
            if time() - start > config["flash-length"]:
                self.deactivate_flash()
                chain.set_color_to_default()
            else:
                chain.rotate_colors()
from collections import deque

from pygame import Rect, Color, mouse

from xenographic_wall.pgfw.GameChild import GameChild
from xenographic_wall.world.scope.chain.Ring import Ring

class Chain(GameChild, Rect):

    transparent_color = Color("green")
    
    def __init__(self, parent):
        GameChild.__init__(self, parent)
        self.init_rect()
        self.set_rings()
        self.subscribe_to(self.get_custom_event_id(), self.respond_to_event)
        self.reset()

    def init_rect(self):
        width = self.get_configuration("scope", "diameter")
        Rect.__init__(self, 0, 0, width, width)

    def set_rings(self):
        rings = []
        for ii in range(self.get_configuration("scope", "ring-count")):
            rings.append(Ring(self, ii))
        self.rings = rings

    def respond_to_event(self, evt):
        if self.parent.active:
            if self.is_command(evt,"mouse-scroll-up"):
                self.glow()
            if self.is_command(evt, "mouse-scroll-down"):
                self.darken()

    def glow(self):
        max_alpha = 255
        rings = list(reversed(self.rings))
        threshold = max_alpha / len(rings)
        for ii, ring in enumerate(rings):
            if ii == 0 or rings[ii - 1].get_alpha() >= threshold:
                alpha = ring.get_alpha() + self.get_glow_step()
                if alpha > max_alpha:
                    alpha = max_alpha
                ring.set_alpha(alpha)

    def get_glow_step(self):
        return self.get_configuration("scope", "glow-step")

    def darken(self):
        for ring in self.rings:
            alpha = ring.get_alpha() - self.get_glow_step()
            if alpha < 0:
                alpha = 0
            ring.set_alpha(alpha)

    def reset(self):
        self.hide()
        self.set_color_to_default()

    def hide(self):
        for ring in self.rings:
            ring.set_alpha(0)

    def show(self):
        for ring in self.rings:
            ring.set_alpha(255)

    def place(self, pos):
        self.center = pos
        for ring in self.rings:
            ring.rect.center = pos

    def set_color_to_default(self):
        self.colors = deque(map(Color,
                                self.get_configuration("scope", "colors")))
        self.update_colors()

    def update_colors(self):
        for ii, ring in enumerate(self.rings):
            ring.set_color(self.colors[ii])

    def set_color_to_flash(self):
        self.colors = deque(map(Color,
                                self.get_configuration("scope", "flash-colors")))
        self.update_colors()

    def rotate_colors(self):
        self.colors.rotate(1)
        self.update_colors()

    def is_hidden(self):
        for ring in self.rings:
            if ring.get_alpha() > 0:
                return False
        return True

    def update(self):
        for ring in self.rings:
            ring.update()
18.97.14.89
18.97.14.89
18.97.14.89
 
May 17, 2018

Line Wobbler Advance is a demake of Line Wobbler for Game Boy Advance that started as a demo for Synchrony. It contains remakes of the original Line Wobbler levels and adds a challenging advance mode with levels made by various designers.


f1. Wobble at home or on-the-go with Line Wobbler Advance

This project was originally meant to be a port of Line Wobbler and kind of a joke (demaking a game made for even lower level hardware), but once the original levels were complete, a few elements were added, including a timer, different line styles and new core mechanics, such as reactive A.I.


f2. Notes on Line Wobbler

I reverse engineered the game by mapping the LED strip on paper and taking notes on each level. Many elements of the game are perfectly translated, such as enemy and lava positions and speeds and the sizes of the streams. The boss spawns enemies at precisely the same rate in both versions. Thanks in part to this effort, Line Wobbler Advance was awarded first prize in the Wild category at Synchrony.


f3. First prize at Synchrony

Advance mode is a series of levels by different designers implementing their visions of the Line Wobbler universe. This is the part of the game that got the most attention. It turned into a twitchy gauntlet filled with variations on the core mechanics, cinematic interludes and new elements, such as enemies that react to the character's movements. Most of the levels are much harder than the originals and require a lot of retries.

Thanks Robin Baumgarten for giving permission to make custom levels and share this project, and thanks to the advance mode designers Prashast Thapan, Charles Huang, John Rhee, Lillyan Ling, GJ Lee, Emily Koonce, Yuxin Gao, Brian Chung, Paloma Dawkins, Gus Boehling, Dennis Carr, Shuichi Aizawa, Blake Andrews and mushbuh!

DOWNLOAD ROM
You will need an emulator to play. Try Mednafen (Windows/Linux) or Boycott Advance (OS X)