Beispiel #1
0
    def load_layers(self):
        rel = "dungeon"
        self.layer_1 = pygame.image.load(c.image_path(f"{rel}_layer_1.png"))
        self.layer_2 = pygame.image.load(c.image_path(f"{rel}_layer_2.png"))
        self.layer_3 = pygame.image.load(c.image_path(f"{rel}_layer_3.png"))

        self.layers = [self.layer_3, self.layer_2, self.layer_1]
Beispiel #2
0
 def initialize(self):
     self.surf = pygame.image.load(c.image_path("title.png"))
     self.surf = pygame.transform.scale(self.surf, c.WINDOW_SIZE)
     font = pygame.font.Font(c.font_path("Myriad.otf"), 20)
     self.enter_surf = font.render("PRESS ENTER", 1, c.WHITE)
     self.thank_surf = pygame.image.load(c.image_path("thanks.png"))
     self.age = 0
Beispiel #3
0
    def __init__(self, game):
        super().__init__(game)
        self.keys = []
        self.skins = []
        self.xs = []
        self.since_click = []
        self.skin_to_spider_surf = {
            skin: self.game.get_static(c.image_path(f"spider_{skin}.png"))
            for skin in range(1, 5)
        }
        self.over = False

        self.black = pygame.Surface(c.WINDOW_SIZE)
        self.black.fill((0, 0, 0))
        self.black_alpha = 255
        self.black_target_alpha = 0

        self.countdown = 10

        self.key_font = pygame.font.Font(c.fonts_path("yoster.ttf"), 75)
        self.long_key_font = pygame.font.Font(c.fonts_path("yoster.ttf"), 40)
        self.note_font = pygame.font.Font(c.fonts_path("yoster.ttf"), 20)
        self.spider_shadow = pygame.Surface((64, 64))
        self.spider_shadow.fill((255, 255, 255))
        pygame.draw.circle(self.spider_shadow, (0, 0, 0), (32, 32), 32)
        self.spider_shadow.set_alpha(40)
        self.spider_shadow.set_colorkey((255, 255, 255))
        self.player_frame = pygame.transform.scale2x(
            pygame.image.load(c.image_path("player_frame.png")))

        self.since_click = [0 for _ in self.game.key_list]

        self.crown = self.game.get_static(c.image_path("crown.png"))
Beispiel #4
0
    def __init__(self, game):
        super().__init__(game)
        self.sprite = Sprite(3, colorkey=c.BLACK)
        self.halberd = Sprite(3, colorkey=c.BLACK)
        idle = SpriteSheet(c.image_path("warden.png"), (1, 1), 1)
        self.sprite.add_animation({"Idle": idle})
        self.sprite.start_animation("Idle")

        idle = SpriteSheet(c.image_path("halberd.png"), (1, 1), 1)
        self.halberd.add_animation({"Idle": idle})
        self.halberd.start_animation("Idle")

        self.x = c.WINDOW_WIDTH // 2
        self.y = 125
        self.age = 0
        self.alpha = -200
        self.target_alpha = 255
        self.name = "Warden"
        self.slashing = False
        self.slash_timer = 0

        self.left = pygame.image.load(c.image_path("warden_left.png")).convert()
        self.left.set_colorkey(c.BLACK)
        self.left.set_alpha(255)
        self.right = pygame.image.load(c.image_path("warden_right.png")).convert()
        self.right.set_colorkey(c.BLACK)
        self.right.set_alpha(255)
Beispiel #5
0
    def __init__(self, game):
        self.game = game
        self.x = c.WINDOW_WIDTH//2
        self.y = c.WINDOW_HEIGHT//2
        self.shield_angle = 0
        self.shield_vis_angle = 0
        self.shield_surf = pygame.image.load(c.image_path("shield.png")).convert()
        self.shield_bonk = pygame.image.load(c.image_path("shield_bonk.png")).convert()
        self.shield_surf.set_colorkey(c.BLACK)
        self.shield_bonk.set_colorkey(c.BLACK)
        self.shield_surf.set_alpha(0)
        self.shield_bonk.set_alpha(0)
        self.radius = 20
        self.shield_radius = 50
        self.shield_spread = 100 # in degrees
        self.has_shield = False
        self.move_disabled = False

        self.surf = pygame.image.load(c.image_path("player.png")).convert()
        self.surf.set_colorkey(c.BLACK)

        self.bonk_time = 0.08
        self.bonk_timer = self.bonk_time
        self.recoil = 0
        self.age = 0
        self.mortal = False

        self.health = 100
        self.dead = False
Beispiel #6
0
 def __init__(self, *args, **kwargs):
     super().__init__(*args, **kwargs)
     self.skin_list = self.game.skin_list
     self.key_list = self.game.key_list
     self.room_num = random.choice([1, 2, 3, 4, 5, 6, 7])
     self.checking_inputs = False
     self.countdown = 3
     self.numbers = [
         self.game.get_static(c.image_path("1.png")),
         self.game.get_static(c.image_path("2.png")),
         self.game.get_static(c.image_path("3.png"))
     ]
Beispiel #7
0
    def __init__(self, game):
        super().__init__(game)
        self.body = pygame.image.load(c.image_path("tetroid.png")).convert()
        self.hands = pygame.image.load(c.image_path("tetroid_hands.png")).convert()
        self.body.set_colorkey(c.BLACK)
        self.hands.set_colorkey(c.BLACK)

        self.x = c.WINDOW_WIDTH//2
        self.y = 125
        self.yoff = 0
        self.age = 0
        self.alpha = -130
        self.target_alpha = 255
        self.name = "Tetroid"
Beispiel #8
0
 def __init__(self, game, room, coords):
     super().__init__(game, room, coords)
     self.surfaces = {}
     for i, item in enumerate(["border_left.png",
                               "border_right.png",
                               "border_bottom.png",
                               "border_top.png",
                               "border_in_bl.png",
                               "border_in_tl.png",
                               "border_in_tr.png",
                               "border_in_br.png",
                               "border_out_bl.png",
                               "border_out_tl.png",
                               "border_out_tr.png",
                               "border_out_br.png"]):
         self.surfaces[i] = pygame.transform.scale2x(self.game.get_static(c.image_path(item)))
     self.surface = pygame.transform.scale2x(self.surface)
     self.blocking = True
     self.layer = 2
     self.black = pygame.Surface((c.TILE_SIZE, c.TILE_SIZE))
     self.black.fill((0, 0, 0))
     self.black_t = self.black.copy()
     self.black_t.set_alpha(40)
     self.black_t.set_colorkey((255, 255, 255))
     self.has_neighbored = False
Beispiel #9
0
 def __init__(self, owner):
     self.id=c.FAST_SHOOTING
     self.name = "Mandible Lubricant"
     self.description = "Improves regurigation efficiency by 80% or more"
     self.duration = 25
     super().__init__(owner)
     self.icon = pygame.transform.scale2x(self.owner.game.get_static(c.image_path("mandible_icon.png")))
Beispiel #10
0
 def __init__(self, owner):
     self.id=c.BOUNCY
     self.name = "Bouncy Bullets"
     self.description = "When the collision code works correctly"
     self.duration = 18
     super().__init__(owner)
     self.icon = pygame.transform.scale2x(self.owner.game.get_static(c.image_path("bouncy_icon.png")))
Beispiel #11
0
 def __init__(self, owner):
     self.id=c.DOUBLE_SHOT
     self.name = "Double Shot"
     self.description = "For that special someone you really want to shoot twice"
     self.duration = 18
     super().__init__(owner)
     self.icon = pygame.transform.scale2x(self.owner.game.get_static(c.image_path("double_icon.png")))
Beispiel #12
0
 def __init__(self, owner):
     self.id=c.SLIPPERY_SOCKS
     self.name = "Slippery Socks"
     self.description = "There better be a bulk discount"
     self.duration = 18
     super().__init__(owner)
     self.icon = pygame.transform.scale2x(self.owner.game.get_static(c.image_path("socks_icon.png")))
Beispiel #13
0
 def __init__(self, owner):
     self.id=c.FAST_SPINNING
     self.duration = 25
     super().__init__(owner)
     self.name = "Caffeine"
     self.description = "Spin to win"
     self.mult = 2
     self.icon = pygame.transform.scale2x(self.owner.game.get_static(c.image_path("spin_icon.png")))
Beispiel #14
0
 def __init__(self, *args, **kwargs):
     super().__init__(*args, **kwargs)
     self.logo = pygame.image.load(c.image_path("star_fish.png"))
     self.logo = pygame.transform.scale2x(self.logo)
     self.age = 0
     self.black = pygame.Surface(c.WINDOW_SIZE)
     self.black.fill((0, 0, 0))
     self.duration = 2.5
     self.angle = -self.duration // 2 * 8
Beispiel #15
0
    def __init__(self, game, owner, pos, velocity=(0, 0), damage=100):
        self.game = game
        self.owner = owner

        self.x, self.y = pos
        self.velocity = list(velocity)
        self.radius = 12
        self.damage = damage
        self.surf = self.game.get_static(c.image_path("bullet.png"))
        self.glow = self.game.get_static(c.image_path("glow.png"))
        self.angle = 0
        self.age = 0

        self.bounces = 0

        self.since_spew = 0

        self._bump_tile = Enemy.bump_tile
        self._check_tile_collisions = Enemy.check_tile_collisions
Beispiel #16
0
 def __init__(self, *args, **kwargs):
     super().__init__(*args,**kwargs)
     self.surface = self.game.get_static(c.image_path("breakable.png"))
     self.surface = pygame.transform.scale2x(self.surface)
     self.has_neighbored = True
     self.broken = False
     self.black = pygame.Surface((c.TILE_SIZE, c.TILE_SIZE))
     self.black.fill((0, 0, 0))
     self.black_t = self.black.copy()
     self.black_t.set_alpha(40)
     self.black_t.set_colorkey((255, 255, 255))
Beispiel #17
0
 def __init__(self, game, surface, pos=(0, 0)):
     self.radius = 24
     self.age = 0
     self.game = game
     self.x, self.y = pos
     self.y_offset = -self.y
     self.surface = surface
     self.shadow = pygame.Surface((self.radius*2, self.radius*2))
     self.shadow.fill((255, 255, 255))
     self.shadow.set_colorkey((255, 255, 255))
     self.shadow.set_alpha(40)
     self.landed = False
     pygame.draw.circle(self.shadow, (0, 0, 0), (self.radius, self.radius), self.radius)
     self.glow = self.game.get_static(c.image_path("glow.png"))
Beispiel #18
0
    def __init__(self, game):
        super().__init__(game)
        self.sprite = Sprite(3, colorkey=c.BLACK)
        idle = SpriteSheet(c.image_path("evil_guy_placeholder.png"), (1, 1), 1)
        self.sprite.add_animation({"Idle": idle})
        self.sprite.start_animation("Idle")
        self.name = "Parity"

        self.x = c.WINDOW_WIDTH//2
        self.y = 125
        self.yoff = 0
        self.age = 0
        self.alpha = 0
        self.target_alpha = 255
Beispiel #19
0
    def __init__(self, game, position=(0, 0)):
        super().__init__(game, None, position=position)
        self.sprite = Sprite(16)
        anim = SpriteSheet(c.image_path("bullet_hit.png"), (8, 1), 8)
        self.sprite.add_animation({"Default": anim})
        self.sprite.start_animation("Default")
        self.game.top_particles.add(self)

        surface = pygame.Surface((100, 100))
        surface.fill((0, 0, 0))
        pygame.draw.circle(surface, (255, 255, 255), (50, 50), 50)
        self.boom = surface
        self.boom.set_colorkey((0, 0, 0))
        self.boom_alpha = 200
        self.boom_size = 40
Beispiel #20
0
 def __init__(self, game):
     self.game = game
     self.lines = []
     self.characters_per_second = 80
     self.advance_arrow = pygame.image.load(
         c.image_path("advance_arrow.png"))
     self.body_font = pygame.font.Font(c.font_path("Myriad.otf"), 20)
     self.enter_font = pygame.font.Font(c.font_path("Myriad.otf"), 12)
     self.chars = {
         char: self.body_font.render(char, 0, c.WHITE)
         for char in c.PRINTABLE_CHARS
     }
     self.red_chars = {
         char: self.body_font.render(char, 0, c.RED)
         for char in c.PRINTABLE_CHARS
     }
     self.blue_chars = {
         char: self.body_font.render(char, 0, c.BLUE)
         for char in c.PRINTABLE_CHARS
     }
     self.green_chars = {
         char: self.body_font.render(char, 0, c.GREEN)
         for char in c.PRINTABLE_CHARS
     }
     self.yellow_chars = {
         char: self.body_font.render(char, 0, c.YELLOW)
         for char in c.PRINTABLE_CHARS
     }
     self.highlight_chars = {
         char: self.body_font.render(char, 0, (255, 60, 60))
         for char in c.PRINTABLE_CHARS
     }
     self.width = 500
     self.height = 140
     self.surf = pygame.Surface((self.width, self.height))
     self.surf.fill((255, 255, 255))
     self.surf.set_alpha(25)
     self.x = c.WINDOW_WIDTH // 2
     self.y = c.WINDOW_HEIGHT - self.height // 2 - 50
     self.active_character = None
     self.enter_to_continue = self.enter_font.render(
         "ENTER TO CONTINUE", 0, c.WHITE)
     self.enter_to_continue.set_alpha(100)
     self.most_recent = None
Beispiel #21
0
    def __init__(self, game):
        super().__init__(game)
        self.keys = []
        self.skins = []
        self.xs = []
        self.since_click = []
        self.skin_to_spider_surf = {
            skin: self.game.get_static(c.image_path(f"spider_{skin}.png"))
            for skin in range(1, 5)
        }
        self.key_font = pygame.font.Font(c.fonts_path("yoster.ttf"), 75)
        self.long_key_font = pygame.font.Font(c.fonts_path("yoster.ttf"), 40)
        self.note_font = pygame.font.Font(c.fonts_path("yoster.ttf"), 20)
        self.spider_shadow = pygame.Surface((64, 64))
        self.spider_shadow.fill((255, 255, 255))
        pygame.draw.circle(self.spider_shadow, (0, 0, 0), (32, 32), 32)
        self.spider_shadow.set_alpha(40)
        self.spider_shadow.set_colorkey((255, 255, 255))
        self.player_frame = pygame.transform.scale2x(
            pygame.image.load(c.image_path("player_frame.png")))

        button_surf = pygame.image.load(c.image_path("button.png"))
        button_hover = pygame.image.load(c.image_path("button_hover.png"))
        button_disabled = pygame.image.load(
            c.image_path("button_disabled.png"))
        button_clicked = pygame.image.load(c.image_path("button_clicked.png"))

        self.black = pygame.Surface(c.WINDOW_SIZE)
        self.black.fill((0, 0, 0))
        self.black_alpha = 255
        self.black_target_alpha = 0

        self.button = Button(button_surf,
                             (c.WINDOW_WIDTH // 2, c.WINDOW_HEIGHT - 135),
                             on_click=self.next_scene,
                             hover_surf=button_hover,
                             click_surf=button_clicked,
                             disabled_surf=button_disabled)
        self.button.disable()
        self.over = False
Beispiel #22
0
 def initialize(self):
     self.surf = pygame.image.load(c.image_path("disclaimer.png"))
     self.surf = pygame.transform.scale(self.surf, (self.surf.get_width() * 2, self.surf.get_height() * 2))
Beispiel #23
0
 def __init__(self, game, pos=(0, 0)):
     surface = game.get_static(c.image_path("mandible.png"))
     super().__init__(game, surface, pos=pos)
Beispiel #24
0
 def __init__(self, *args, **kwargs):
     super().__init__(*args, **kwargs)
     self.surface = self.game.get_static(c.image_path("grass.png"))
     self.surface = pygame.transform.scale2x(self.surface)
Beispiel #25
0
 def initialize(self):
     self.fish = pygame.image.load(c.image_path("logo.png"))
     self.fish = pygame.transform.scale(self.fish, (self.fish.get_width() * 2, self.fish.get_height() * 2))
Beispiel #26
0
 def load_image(self, path, flipped=False):
     if path not in self.image_dict:
         self.image_dict[path] = pygame.image.load(c.image_path(path))
     if flipped:
         return pygame.transform.flip(self.image_dict[path], True, False)
     return self.image_dict[path]
Beispiel #27
0
    def __init__(self, game, skin=1, player_num=1):
        self.game = game
        self.controller = Player.ButtonController()

        self.effects = []

        self.radius = 26
        self.charged = 0
        self.charging = False
        self.props = {
            CHARGE_TIME: 1,
            SPIN_SPEED: 160,  # degrees per second
            CHARGED_SPEED: 60,  # degrees per second
            KNOCKBACK: 800,
            MAX_SHAKE: 6,
            BULLET_TYPE: Bullet,
            BULLET_SPEED: 800,
            DAMAGE: 70
        }

        self.friendly = [self]

        self.sailing = False
        self.since_fire = 0
        self.sail_time = 0.1
        self.temp_sail_time = self.sail_time

        self.angle = 0  # degrees CCW from right

        self.x, self.y = self.game.room.spawns[player_num]

        self.velocity = [0, 0]

        self.skin = skin

        self.color_dict = {
            1: (255, 230, 220),
            2: (230, 220, 255),
            3: (0, 255, 0),
            4: (255, 0, 255),
            5: (255, 255, 255)
        }
        self.color = self.color_dict[self.skin]

        self.surf = pygame.image.load(c.image_path(f"player_{skin}.png"))
        self.dead_surf = pygame.image.load(
            c.image_path(f"player_{skin}_dead.png"))
        self.blink_surf = pygame.mask.from_surface(
            self.surf).to_surface().convert()
        self.blink_surf.set_colorkey((0, 0, 0))
        self.legs_1 = pygame.image.load(c.image_path(f"legs_1_{skin}.png"))
        self.blink_legs_1 = pygame.mask.from_surface(
            self.legs_1).to_surface().convert()
        self.blink_legs_1.set_colorkey((0, 0, 0))
        self.legs_2 = pygame.image.load(c.image_path(f"legs_2_{skin}.png"))
        self.blink_legs_2 = pygame.mask.from_surface(
            self.legs_2).to_surface().convert()
        self.blink_legs_2.set_colorkey((0, 0, 0))
        self.leg_step_amt = 15
        size = 1.35
        self.shadow = pygame.Surface(
            (int(c.TILE_SIZE * size), int(c.TILE_SIZE * size)))
        self.shadow.fill((255, 255, 255))
        self.shadow.set_colorkey((255, 255, 255))
        self.shadow.set_alpha(60)
        pygame.draw.circle(
            self.shadow, (0, 0, 0),
            (self.shadow.get_width() // 2, self.shadow.get_height() // 2),
            self.shadow.get_width() // 2)

        self.one_leg = pygame.Surface((22, 29))
        self.one_leg.fill((255, 255, 0))
        self.one_leg.set_colorkey((255, 255, 0))
        self.one_leg.blit(self.legs_2, (-21, -16))

        self.charge_threshold = 0.7

        self.since_damage = 100
        self.dead = False

        self.hp = 100
        self.arrow = pygame.image.load(c.image_path("arrow.png"))
        self.arrow.set_colorkey((0, 0, 0))
Beispiel #28
0
 def __init__(self, *args, **kwargs):
     super().__init__(*args, **kwargs)
     self.logo = pygame.image.load(c.image_path("ld47.png"))
Beispiel #29
0
 def __init__(self, *args, **kwargs):
     super().__init__(*args, **kwargs)
     self.speed = 100
     self.surface = pygame.image.load(c.image_path("fly.png"))