from os.path import join

from lib.pgfw.pgfw.Sprite import Sprite

class Background(Sprite):

    def __init__(self, parent):
        Sprite.__init__(self, parent)
        self.load_from_path(join(self.get_resource("door", "path"),
                                 str(self.parent.parent.index),
                                 "background.png"), True, True)
        self.location.bottom = self.parent.parent.platforms[0].location.top
        self.reset()

    def reset(self):
        self.location.left = self.parent.foreground.location.right

    def update(self):
        self.move(-self.parent.parent.velocity[0])
        Sprite.update(self)
from os.path import join

from lib.pgfw.pgfw.Sprite import Sprite

class Foreground(Sprite):

    def __init__(self, parent):
        Sprite.__init__(self, parent)
        self.load_configuration()
        index = str(self.parent.parent.index)
        self.load_from_path(self.get_resource(join(self.root, index,
                                                   "foreground.png")), True,
                            True)
        self.location.bottom = self.parent.parent.platforms[0].location.top
        self.reset()

    def reset(self):
        self.location.left = self.x

    def load_configuration(self):
        config = self.get_configuration("door")
        self.x = config["x"]
        self.root = config["path"]

    def update(self):
        self.move(-self.parent.parent.velocity[0])
        Sprite.update(self)
from random import randint, random

from lib.pgfw.pgfw.GameChild import GameChild
from food_spring.level.obstacle.Missile import Missile
from food_spring.level.obstacle.Hurdle import Hurdle
from food_spring.level.obstacle.Spikes import Spikes
from food_spring.level.obstacle.Fireball import Fireball

class Obstacles(GameChild, dict):

    def __init__(self, parent):
        GameChild.__init__(self, parent)
        self.load_configuration()
        self.init_dict()

    def load_configuration(self):
        config = self.get_configuration
        self.missile_chance = config("missile", "chance")
        self.missile_count = config("missile", "count")
        self.blink_rate = config("obstacle", "blink-rate")
        self.hurdle_count = config("hurdle", "count")
        self.hurdle_chance = config("hurdle", "chance")
        self.hurdle_first = config("hurdle", "first-range")
        self.hurdle_margin = config("hurdle", "margin")
        self.spikes_chance = config("spikes", "chance")
        self.fireball_chance = config("fireball", "chance")
        self.fireball_count = config("fireball", "count")

    def init_dict(self):
        missiles = [Missile(self) for _ in xrange(self.missile_count[1])]
        hurdles = [Hurdle(self) for _ in xrange(self.hurdle_count[1])]
        fireballs = [Fireball(self) for _ in xrange(self.fireball_count[1])]
        dict.__init__(self, {"missile": missiles, "spikes": [Spikes(self)],
                             "hurdle": hurdles, "fireball": fireballs})

    def reset(self):
        for obstacle in self.get_obstacles():
            obstacle.reset()

    def get_obstacles(self, exclude=[]):
        if isinstance(exclude, str):
            exclude = [exclude]
        for kind in set(("hurdle", "fireball", "spikes",
                         "missile")).difference(exclude):
            for obstacle in self[kind]:
                yield obstacle

    def update(self):
        if self.parent.is_going():
            self.spawn_missiles()
            self.spawn_hurdles()
            self.spawn_spikes()
            self.spawn_fireballs()
        for obstacle in self.get_obstacles():
            obstacle.update()

    def spawn_missiles(self):
        if all(not missile.is_flying() for missile in self["missile"]):
            if random() < self.missile_chance:
                for ii in xrange(randint(*self.missile_count)):
                    self["missile"][ii].queue_fly()

    def spawn_hurdles(self):
        if all(not hurdle.is_playing(hurdle.enter) and \
               not hurdle.is_playing(hurdle.exit) for \
               hurdle in self["hurdle"]):
            if random() < self.hurdle_chance:
                dy = randint(*self.hurdle_first)
                for ii in xrange(randint(*self.hurdle_count)):
                    self["hurdle"][ii].queue_entrance(dy)
                    dy += randint(*self.hurdle_margin)

    def spawn_spikes(self):
        if not self["spikes"][0].is_playing(self["spikes"][0].slide):
            if random() < self.spikes_chance:
                self["spikes"][0].queue_slide()

    def spawn_fireballs(self):
        if all(not fireball.is_playing(fireball.spew) for fireball in \
               self["fireball"]):
            if random() < self.fireball_chance:
                for ii in xrange(randint(*self.fireball_count)):
                    self["fireball"][ii].queue_spew()
from pygame import Surface

from lib.pgfw.pgfw.Sprite import Sprite

class Hurdle(Sprite):

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

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

    def set_frames(self):
        surface = Surface((32, 8))
        surface.fill((255, 255, 0))
        self.add_frame(surface, omit=True)
        self.add_frameset(0, name="entered")
        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.enter)
        self.halt(self.exit)
        self.active = False
        self.queue_reset = False
        self.location.centerx = self.display_surface.get_rect().left
        self.set_frameset("queued")

    def queue_entrance(self, dy):
        self.location.centery = self.parent.parent.platforms[0].location.top - \
                                dy
        self.active = True
        self.play(self.enter, delay=self.delay)

    def enter(self):
        self.set_frameset("entered")
        self.move(self.speed, 0)
        if self.location.centerx >= self.display_surface.get_rect().centerx:
            self.halt(self.enter)
            self.play(self.exit, delay=self.pause)

    def exit(self):
        self.move(self.speed, 0)
        if self.location.right >= self.display_surface.get_rect().right:
            self.queue_reset = True

    def update(self):
        if self.active:
            if self.is_playing(self.enter, include_delay=True) or \
               self.is_playing(self.exit):
                if self.location.colliderect(self.parent.parent.food):
                    self.parent.parent.food.freeze()
            Sprite.update(self)
        if self.queue_reset:
            self.reset()
44.222.218.145
44.222.218.145
44.222.218.145
 
March 22, 2020

The chicken nugget business starter kit is now available online! Send me any amount of money through Venmo or PayPal, and I will mail you a package which will enable you to start a chicken nugget business of your own, play a video game any time you want, introduce a new character into your Animal Crossing village, and start collecting the chicken nugget trading cards.

The kit includes:

  • jellybean
  • instruction manual
  • limited edition trading card

By following the instructions you'll learn how to cook your own chicken or tofu nugget and be well on your way to financial success. I'm also throwing in one randomly selected card from the limited edition trading card set. Collect them, trade them, and if you get all eighteen and show me your set, I will give you an exclusive video game product.

All orders are processed within a day, so you can have your kit on your doorstep as quickly as possible. Don't sleep on this offer! Click the PayPal button or send a Venmo payment of any amount to @ohsqueezy, and in a matter of days you'll be counting money and playing video games.

PayPal me