from xenographic_wall.pgfw.Configuration import TypeDeclarations
from xenographic_wall.pgfw.Game import Game
from xenographic_wall.Introduction import Introduction
from xenographic_wall.world.World import World

class XenographicWall(Game):

    def __init__(self):
        Game.__init__(self, type_declarations=Types())
        self.introduction.activate()

    def set_children(self):
        Game.set_children(self)
        self.introduction = Introduction(self)
        self.world = World(self)

    def update(self):
        self.introduction.update()
        self.world.update()


class Types(TypeDeclarations):

    additional_defaults = \
        {"intro": \
         {"path": ["mask", "cord", "starfield", "sunburst"],
          "int": ["frame-duration", "starfield-max-alpha",
                  "prompt-visible-frames", "reset-delay"],
          "int-list": ["cord-y-range", "zoom-upper-left",
                       "zoom-region-dimensions"],
          "float": ["cord-speed", "zoom-step-ratio", "sunburst-delay",
                    "zoom-delay", "starfield-fade-step"]},
         "scope": \
         {"int": ["diameter", "ring-count", "flash-length"],
          "list": ["colors", "flash-colors"],
          "float": ["glow-step"]},
         "world": \
         {"path": "audio",
          "int-list": ["dimensions", "frame-border", "scroll-speed"]},
         "mushrooms": \
         {"int": "count", "list": "images", "path": "path"},
         "creature": \
         {"path": "root"}}
from pygame import mouse, Color, Surface, Rect

from xenographic_wall.pgfw.GameChild import GameChild
from xenographic_wall.world.scope.Scope import Scope
from xenographic_wall.world.mushrooms.Mushrooms import Mushrooms
from xenographic_wall.creatures.Creatures import Creatures

class World(GameChild, Surface):

    def __init__(self, parent):
        GameChild.__init__(self, parent)
        self.init_surface()
        self.deactivate()
        self.initialize_clip()
        self.scope = Scope(self)
        self.mushrooms = Mushrooms(self)
        self.set_frame()
        self.subscribe_to(self.get_custom_event_id(), self.respond_to_event)
        self.creatures = Creatures(self)
        self.reset()

    def init_surface(self):
        size = self.get_configuration().get("world", "dimensions")
        Surface.__init__(self, size)

    def deactivate(self):
        self.active = False

    def respond_to_event(self, evt):
        if self.is_command(evt, "cancel-introduction"):
            self.activate()
        elif self.is_command(evt, "reset-game"):
            self.reset()

    def activate(self):
        self.active = True
        self.scope.activate()
        self.get_audio().play_bgm(self.get_resource("world", "audio"))
        mouse.set_pos(self.get_screen().get_rect().center)

    def get_mouse_pos(self):
        pos = mouse.get_pos()
        clip = self.get_clip()
        return pos[0] + clip.left, pos[1] + clip.top

    def initialize_clip(self):
        clip = Rect((0, 0), self.get_screen().get_size())
        clip.center = self.get_rect().center
        self.set_clip(clip)

    def set_frame(self):
        border = self.get_configuration("world", "frame-border")
        screen = self.get_screen()
        frame = Rect((0, 0), screen.get_size())
        frame.w -= border[0]
        frame.h -= border[1]
        frame.center = screen.get_rect().center
        self.frame = frame

    def reset(self):
        self.deactivate()
        self.scope.reset()
        self.initialize_clip()
        self.creatures.reset()

    def update(self):
        if self.active:
            self.clear()
            self.update_clip()
            self.scope.update()
            self.mushrooms.update()
            self.creatures.update()
            self.draw()

    def clear(self):
        self.fill(Color("black"))

    def update_clip(self):
        x, y = mouse.get_pos()
        frame = self.frame
        move = self.move_clip
        dx, dy = 0, 0
        if not frame.collidepoint((x, y)):
            if y < frame.top:
                dy = y - frame.top
            elif y > frame.bottom:
                dy = y - frame.bottom
            if x < frame.left:
                dx = x - frame.left
            elif x > frame.right:
                dx = x - frame.right
            mx, my = self.get_configuration("world", "scroll-speed")
            move(dx / mx, dy / my)

    def move_clip(self, x=0, y=0):
        clip = self.get_clip()
        bound = self.get_rect()
        original_center = clip.center
        clip.top += y
        if clip.top < bound.top:
            clip.top = bound.top
        elif clip.bottom > bound.bottom:
            clip.bottom = bound.bottom
        clip.left += x
        if clip.left < bound.left:
            clip.left = bound.left
        elif clip.right > bound.right:
            clip.right = bound.right
        self.set_clip(clip)
        new_center = clip.center
        return new_center[0] - original_center[0], \
               new_center[1] - original_center[1]

    def draw(self):
        screen = self.get_screen()
        screen.blit(self, (0, 0), self.get_clip())
from random import randrange

from pygame import Surface, Color, Rect

from xenographic_wall.pgfw.GameChild import GameChild

class Mushroom(GameChild, Surface):

    transparent_color = Color("magenta")

    def __init__(self, parent, group, images):
        GameChild.__init__(self, parent)
        self.group = group
        self.images = images
        self.init_surface()
        self.place()
        self.eaten = False
        self.bitten = False

    def init_surface(self):
        image = self.images[0]
        Surface.__init__(self, image.get_size())
        self.clear()
        self.set_colorkey(self.transparent_color)
        self.blit(image, (0, 0))

    def clear(self):
        self.fill(self.transparent_color)

    def place(self):
        world = self.parent.parent
        size = self.get_size()
        x_bound = world.get_width() - size[0]
        y_bound = world.get_height() - size[1]
        self.rect = Rect((randrange(0, x_bound), randrange(0, y_bound)), size)

    def eat(self):
        self.eaten = True

    def bite(self):
        self.clear()
        self.blit(self.images[1], (0, 0))
        self.bitten = True
        sound = self.get_configuration("mushrooms", "bite-sound")
        self.get_audio().play_fx(sound, self.get_x_ratio())

    def get_x_ratio(self):
        return float(self.rect.centerx) / self.parent.parent.get_width()
        
    def update(self):
        self.draw()

    def draw(self):
        self.parent.parent.blit(self, self.rect)
216.73.216.233
216.73.216.233
216.73.216.233
 
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