from pygame import Surface

from lib.pgfw.pgfw.Sprite import Sprite

class Spikes(Sprite):

    def __init__(self, parent):
        Sprite.__init__(self, parent)
        self.load_configuration()
        self.set_frames()
        self.register(self.slide)
        self.reset()

    def load_configuration(self):
        config = self.get_configuration("spikes")
        self.delay = config["delay"]
        self.speed = config["speed"]

    def set_frames(self):
        surface = Surface((32, 8))
        surface.fill((0, 255, 0))
        self.add_frame(surface, omit=True)
        self.add_frameset(0, name="sliding")
        blank = Surface(self.location.size)
        blank.set_colorkey((0, 0, 0))
        self.add_frame(blank, omit=True)
        self.add_frameset([0, 1], self.parent.blink_rate, "queued")

    def reset(self):
        self.set_frameset("queued")
        self.halt(self.slide)
        self.active = False
        self.queue_reset = False
        self.location.center = self.display_surface.get_rect().right, \
                               self.parent.parent.platforms[0].location.top

    def queue_slide(self):
        self.active = True
        self.play(self.slide, delay=self.delay)

    def slide(self):
        self.set_frameset("sliding")
        self.move(-self.speed)
        if self.location.right <= self.display_surface.get_rect().left:
            self.queue_reset = True
        if self.location.colliderect(self.parent.parent.food):
            self.parent.parent.food.freeze()

    def update(self):
        if self.active:
            Sprite.update(self)
        if self.queue_reset:
            self.reset()
from random import randrange

from pygame import Surface

from lib.pgfw.pgfw.Sprite import Sprite

class Fireball(Sprite):

    def __init__(self, parent):
        Sprite.__init__(self, parent)
        self.load_configuration()
        self.set_frames()
        self.register(self.spew)
        self.reset()

    def load_configuration(self):
        config = self.get_configuration("fireball")
        self.delay = config["delay"]
        self.speed = config["speed"]
        self.peak = config["peak"]

    def set_frames(self):
        surface = Surface((24, 8))
        surface.fill((0, 255, 255))
        self.add_frame(surface, omit=True)
        self.add_frameset(0, name="spewing")
        blank = Surface(self.location.size)
        blank.set_colorkey((0, 0, 0))
        self.add_frame(blank, omit=True)
        self.add_frameset([0, 1], self.parent.blink_rate, "queued")

    def reset(self):
        self.halt(self.spew)
        self.set_frameset("queued")
        self.active = False
        self.queue_reset = False
        limit = self.display_surface.get_rect()
        self.location.midleft = randrange(0, limit.w - self.location.w), limit.h
        self.direction = -1

    def queue_spew(self):
        self.active = True
        self.play(self.spew, delay=self.delay)

    def spew(self):
        self.set_frameset("spewing")
        self.move(0, self.direction * self.speed)
        limit = self.parent.parent.platforms[0].location.top - self.peak
        if self.direction == -1 and self.location.centery <= limit:
            self.location.centery = limit
            self.direction = 1
        elif self.direction == 1 and \
             self.location.top >= self.display_surface.get_height():
            self.queue_reset = True
        if self.location.colliderect(self.parent.parent.food):
            self.parent.parent.food.freeze()

    def update(self):
        if self.active:
            Sprite.update(self)
        if self.queue_reset:
            self.reset()
from math import atan, degrees, radians, sqrt, sin, cos
from random import randint, randrange

from pygame import Surface
from pygame.transform import rotate

from lib.pgfw.pgfw.Sprite import Sprite

class Missile(Sprite):

    def __init__(self, parent):
        Sprite.__init__(self, parent)
        self.display_surface = self.get_display_surface()
        self.load_configuration()
        self.set_step()
        self.set_frames()
        self.register(self.fly)
        self.reset()

    def load_configuration(self):
        config = self.get_configuration("missile")
        self.margin = config["margin"]
        self.speed = config["speed"]
        self.peak = config["peak"]
        self.delay = config["delay"]
        self.angle = config["angle"]

    def set_step(self):
        angle = radians(self.angle)
        self.step = sin(angle) * self.speed, cos(angle) * self.speed

    def set_frames(self):
        surface = Surface((8, 32))
        surface.fill((255, 0, 0))
        surface.set_colorkey((255, 0, 255))
        self.add_frame(rotate(surface, self.angle), omit=True)
        self.add_frameset(0, name="flying")
        blank = Surface(self.location.size)
        blank.set_colorkey((0, 0, 0))
        self.add_frame(blank, omit=True)
        self.add_frameset([0, 1], self.parent.blink_rate, "queued")

    def reset(self):
        self.halt(self.fly)
        self.active = False
        self.queue_reset = False
        self.location.center = randrange(40, 640), 0
        self.set_frameset("queued")

    def is_flying(self):
        return self.is_playing(self.fly)

    def queue_fly(self):
        self.active = True
        self.play(self.fly, delay=self.delay)

    def fly(self):
        self.set_frameset("flying")
        self.move(*self.step)
        location = self.location
        if location.colliderect(self.parent.parent.food):
            self.parent.parent.food.freeze()
        if location.top > self.display_surface.get_height():
            self.queue_reset = True

    def update(self):
        if self.active:
            Sprite.update(self)
        if self.queue_reset:
            self.reset()
from lib.pgfw.pgfw.Sprite import Sprite

class Blob(Sprite):

    def __init__(self, parent):
        Sprite.__init__(self, parent)
        self.load_from_path(self.get_resource("blob", "path"), True, True,
                            query="*.png")
        self.hide()

    def hide(self):
        self.visible = False

    def show(self):
        self.visible = True

    def update(self):
        if self.visible:
            if not self.parent.horizontal:
                self.location.centerx = self.parent.parent.food.location.centerx
            else:
                self.location.centery = self.parent.parent.food.location.centery
            Sprite.update(self)
3.145.186.173
3.145.186.173
3.145.186.173
 
July 19, 2017


f1. BOSS

Games are corrupt dissolutions of nature modeled on prison, ordering a census from the shadows of a vile casino, splintered into shattered glass, pushing symbols, rusted, stale, charred, ultraviolet harbingers of consumption and violence, badges without merit that host a disease of destruction and decay.

You are trapped. You are so trapped your only recourse of action is to imagine an escape route and deny your existence so fully that your dream world becomes the only reality you know. You are fleeing deeper and deeper into a chasm of self-delusion.

While you're dragging your listless, distending corpus from one cell to another, amassing rewards, upgrades, bonuses, achievements, prizes, add-ons and status boosts in rapid succession, stop to think about what's inside the boxes because each one contains a vacuous, soul-sucking nightmare.

Playing can be an awful experience that spirals one into a void of harm and chaos, one so bad it creates a cycle between the greater and lesser systems, each breaking the other's rules. One may succeed by acting in a way that ruins the world.