from pygame.image import load

from lib.pgfw.pgfw.GameChild import GameChild

class Title(GameChild):

    def __init__(self, parent):
        GameChild.__init__(self, parent)
        self.display_surface = self.get_display_surface()
        self.delegate = self.get_delegate()
        self.audio = self.get_audio()
        self.load_configuration()
        self.set_background()
        self.subscribe(self.respond)
        self.reset()

    def load_configuration(self):
        config = self.get_configuration("title")
        self.background_path = self.get_resource("title", "background")
        self.audio_path = self.get_resource("title", "audio")

    def set_background(self):
        self.background = load(self.background_path).convert()

    def respond(self, event):
        if self.active:
            if self.delegate.compare(event, "any"):
                self.deactivate()
                self.parent.home.activate()
        if self.activate_queued:
            self.activate()
            self.activate_queued = False

    def reset(self):
        self.activate_queued = False
        self.deactivate()

    def deactivate(self):
        self.active = False
        self.audio.stop_current_channel()

    def activate(self):
        self.active = True
        self.audio.play_bgm(self.audio_path)

    def queue_activation(self):
        self.activate_queued = True

    def update(self):
        if self.active:
            self.display_surface.blit(self.background, (0, 0))
from os.path import join

from pygame import Surface
from pygame.font import Font
from pygame.locals import *

from lib.pgfw.pgfw.Animation import Animation
from food_spring.level.land.Land import Land
from food_spring.level.platform.Platforms import Platforms
from food_spring.level.Food import Food
from food_spring.level.planet.Planet import Planet
from food_spring.level.stars.Stars import Stars
from food_spring.level.drop.Drops import Drops
from food_spring.level.door.Door import Door
from food_spring.level.ExitArrow import ExitArrow
from food_spring.level.obstacle.Obstacles import Obstacles
from food_spring.level.Window import Window

class Level(Animation):

    any_press_ignored = "left"
    transparent_color = 255, 0, 255

    def __init__(self, parent, index, horizontal_drop=False):
        Animation.__init__(self, parent)
        self.index = index
        self.display_surface = self.get_display_surface()
        self.input = self.get_input()
        self.compare = self.get_delegate().compare
        self.audio = self.get_audio()
        self.timer = self.get_game().timer
        self.siphon = self.get_game().siphon
        self.velocity = [0, 0]
        self.time = 0.0
        self.altitude = 0
        self.load_configuration()
        self.assign_defaults()
        self.set_background()
        self.land = Land(self)
        self.planet = Planet(self)
        self.stars = Stars(self)
        self.guns = self.parent.parent.gun_library[index]
        self.drops = Drops(self)
        self.platforms = Platforms(self)
        self.food = Food(self)
        self.door = Door(self)
        self.exit_arrow = ExitArrow(self)
        self.obstacles = Obstacles(self)
        self.window = Window(self)
        self.saved_food_surface = self.food.display_surface
        self.subscribe(self.respond)
        self.register(self.go, self.stall, self.enter, self.transition_to_go,
                      self.exit, self.fade_in_arrow)
        self.deactivate()

    def load_configuration(self):
        config = self.get_configuration("level")
        self.background_color = config["background-color"]
        self.gravity = config["gravity"]
        self.velocity_range = config["velocity"]
        self.stall_length = config["stall"]
        self.fall_pause = config["fall-pause"]
        self.entrance_offset = config["entrance-offset"]
        self.entrance_speed = config["entrance-speed"]
        self.audio_root = config["audio"]

    def assign_defaults(self):
        self.distance = 0.0
        self.velocity[0] = 0.0
        self.time = 0.0
        self.reset_queued = False

    def set_background(self):
        surface = Surface(self.display_surface.get_size())
        surface.fill(self.background_color)
        self.background = surface

    def deactivate(self):
        self.active = False
        self.halt()
        self.input.unregister_any_press_ignore(self.any_press_ignored)
        self.restore_food_surface()
        self.audio.stop_current_channel()

    def restore_food_surface(self):
        self.food.display_surface = self.saved_food_surface

    def respond(self, event):
        if self.compare(event, "reset-game"):
            self.deactivate()
        elif self.active and self.compare(event, "left") and \
                 self.exit_available and self.is_playing(check_all=True):
            self.halt()
            self.timer.stop()
            self.velocity[0] = 0.0
            food = self.food.location
            difference = self.platforms[0].location.right - food.right
            rect = self.get_entrance_mask()[1]
            food.bottomright = rect.w - difference, rect.h
            self.play(self.exit)

    def reset(self):
        self.assign_defaults()
        self.land.reset()
        self.drops.reset()
        self.platforms.reset()
        self.food.reset()
        self.door.reset()
        self.exit_arrow.reset()
        self.obstacles.reset()
        self.window.reset()

    def activate(self):
        self.active = True
        self.exit_available = False
        self.siphon.set_level(self.index)
        self.reset()
        self.input.register_any_press_ignore(self.any_press_ignored)
        mask, rect = self.get_entrance_mask()
        self.food.location.bottomleft = -self.entrance_offset, rect.h
        self.saved_food_surface = self.food.display_surface
        self.audio.play_bgm(self.get_resource(join(self.audio_root,
                                                   str(self.index) + ".ogg")))
        self.play(self.enter)

    def get_entrance_mask(self):
        base = self.door.foreground.location
        width = self.platforms[0].location.right - base.right
        mask = Surface((width, base.h), SRCALPHA)
        rect = mask.get_rect()
        rect.topleft = base.topright
        return mask, rect

    def enter(self):
        self.food.move(self.entrance_speed)
        mask, rect = self.get_entrance_mask()
        self.food.display_surface = mask
        self.clear_and_update_children()
        self.display_surface.blit(mask, rect)
        if self.food.location.left >= self.food.offset - rect.left:
            self.restore_food_surface()
            self.food.place_at_start()
            self.halt()
            self.play(self.stall)
            self.play(self.transition_to_go, delay=self.stall_length)

    def go(self):
        self.distance += self.velocity[0]
        self.clear_and_update_children()
        self.accelerate()
        self.time += 1
        if self.reset_queued:
            self.reset()
            self.halt()
            self.timer.stop()
            self.exit_available = True
            self.play(self.stall, delay=self.fall_pause)
            self.play(self.fade_in_arrow, delay=self.fall_pause)
            self.play(self.transition_to_go,
                      delay=self.stall_length + self.fall_pause)

    def stall(self):
        self.clear_and_update_children()

    def transition_to_go(self):
        self.halt()
        self.velocity[0] = self.velocity_range[0]
        self.timer.start()
        self.play(self.go)

    def fade_in_arrow(self):
        self.exit_arrow.fade(out=False)

    def exit(self):
        self.food.move(-self.entrance_speed)
        mask, rect = self.get_entrance_mask()
        self.food.display_surface = mask
        self.clear_and_update_children()
        self.display_surface.blit(mask, rect)
        if self.food.location.left <= -self.entrance_offset:
            self.restore_food_surface()
            self.halt()
            self.deactivate()
            self.get_game().home.activate()

    def queue_reset(self):
        self.reset_queued = True

    def is_going(self):
        return self.is_playing(self.go)

    def update(self):
        if self.active:
            Animation.update(self)

    def clear_and_update_children(self):
        self.clear()
        self.stars.update()
        self.planet.update()
        self.siphon.update()
        self.land.update()
        self.door.background.update()
        self.exit_arrow.update()
        self.guns.update()
        if not self.food.scope.active:
            self.food.update()
        self.door.foreground.update()
        self.drops.update()
        self.platforms.update()
        if self.food.scope.active:
            self.food.update()
        self.obstacles.update()
        self.window.update()

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

    def accelerate(self):
        time = self.time
        minimum, maximum = self.velocity_range
        self.velocity[0] =  minimum + time * maximum / (2000 + time)
        # self.print_velocity()

    def print_velocity(self):
        surface = Font(None, 24).render("%.2f" % self.velocity[0], False,
                                        (255, 255, 255))
        self.get_display_surface().blit(surface, (0, 0))
35.172.233.2
35.172.233.2
35.172.233.2
 
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)