from pygame import image

from esp_hadouken.GameChild import *

class Exit(GameChild):

    def __init__(self, parent):
        GameChild.__init__(self, parent)
        self.load_image()
        self.set_rect()

    def load_image(self):
        img = image.load(self.get_resource("level-exit-path")).convert()
        img.set_alpha(self.get_configuration()["level-exit-alpha"])
        self.img = img

    def set_rect(self):
        rect = self.img.get_rect()
        width, height = self.parent.get_size()
        rect.bottomright = width - 10, height - 8
        self.rect = rect

    def draw(self):
        self.parent.blit(self.img, self.rect)
from pygame import Surface, Color, Rect

from esp_hadouken.GameChild import GameChild

class Void(Surface, GameChild):

    transparent_color = Color("magenta")
    opaque_color = Color("black")

    def __init__(self, parent):
        GameChild.__init__(self, parent)
        Surface.__init__(self, parent.get_size())
        self.set_colorkey(self.transparent_color)
        self.set_background()

    def set_background(self):
        bg = Surface(self.parent.get_clip().size)
        bg.fill(self.transparent_color)
        self.background = bg.convert()

    def update(self):
        self.set_clip()
        self.clear()
        self.update_area()
        self.draw()

    def set_clip(self):
        Surface.set_clip(self, self.parent.get_clip())

    def clear(self):
        self.blit(self.background, self.get_clip())

    def update_area(self):
        pass

    def draw(self):
        clip = self.get_clip()
        self.parent.blit(self, clip, clip)
from pygame.locals import *

from esp_hadouken.GameChild import *
from esp_hadouken.Input import *
from octo.Octo import *
from diortem.Diortem import *
from circulor.Circulor import *
from horse.Horse import *
from tooth.Tooth import *

class LevelFactory(GameChild):

    level = None

    def __init__(self, game):
        GameChild.__init__(self, game)
        self.subscribe_to_events()

    def subscribe_to_events(self):
        self.subscribe_to(USEREVENT, self.load_level)
        self.subscribe_to(Input.command_event, self.clear_level)

    def load_level(self, evt):
        if evt.name == "bandit-encountered":
            bandit = evt.bandit
            self.level = globals()[bandit.name.capitalize()](self)

    def clear_level(self, evt=None):
        if not evt or evt.command == "reset":
            if self.level:
                self.level.end()
            self.level = None

    def update(self):
        if self.level:
            self.level.update()
from os.path import join

from esp_hadouken.sprite.Sprite import *
from esp_hadouken.GameChild import *

class Bandit(Sprite):

    def __init__(self, parent):
        GameChild.__init__(self, parent)
        self.init_sprite()
        self.place()
        self.show()

    def init_sprite(self):
        name = self.parent.get_name()
        config = self.get_configuration()
        directory = self.get_resource("level-bandit-sprite-path")
        path = join(directory, name + config["image-extension"])
        Sprite.__init__(self, self.parent, path, self.parent)

    def place(self):
        name = self.parent.get_name()
        pos = self.get_configuration()[name + "-level-bandit-position"]
        self.rect.center = pos
from pygame import Surface, Color

from esp_hadouken.GameChild import *
from esp_hadouken.Font import *

class Distance(GameChild, Surface):

    transparent_color = Color("magenta")

    def __init__(self, parent):
        GameChild.__init__(self, parent)
        self.init_surface()
        self.set_font()
        self.rect = self.get_rect()

    def init_surface(self):
        Surface.__init__(self, self.get_configuration()["distance-dimensions"])
        self.set_colorkey(self.transparent_color)

    def set_font(self):
        self.font = Font(self, self.get_configuration()["distance-text-size"])

    def place(self):
        self.rect.bottomleft = self.parent.get_clip().bottomleft

    def update(self):
        self.clear()
        self.place()
        self.render_distance()
        self.draw()

    def clear(self):
        self.fill(Color(self.get_configuration()["distance-background-color"]))

    def render_distance(self):
        config = self.get_configuration()
        distance = self.parent.get_distance_to_target()
        text = "%i%s" % (int(distance * config["distance-modifier"]),
                         config["distance-suffix"])
        color = Color(config["distance-text-color"])
        rend = self.font.render(text, True, color)
        rect = rend.get_rect()
        rect.center = self.get_rect().center
        self.blit(rend, rect)

    def draw(self):
        self.parent.blit(self, self.rect)
from esp_hadouken.levels.Level import *
from void.Void import *

class Diortem(Level):

    def __init__(self, parent):
        Level.__init__(self, parent)

    def set_void(self):
        self.void = Void(self)
3.233.242.67
3.233.242.67
3.233.242.67
 
November 10, 2013


Food Spring - Watermelon Stage

Getting the fruit as far as possible is the object of each level, collecting bigger, more valuable guns. The final result is determined by the size of the fruits' collection when the monkey arrives in North America and either survives or perishes in the fruits' attack.

Watermelon Peach
Pineapple Grapes