Ejemplo n.º 1
0
    def draw(self, screen: pg.Surface, clock: pg.time.Clock):
        cx, cy = SCREEN_WIDTH // 2, SCREEN_HEIGHT // 2

        for i in range(-2, 3):
            for j in range(-2, 3):
                screen.blit(get_sprite(FLOOR), (cx + i*TILE_WIDTH, cy + j * TILE_HEIGHT))

        if self.step == 1:
            screen.blit(get_sprite(OHNOES1), (cx - TILE_WIDTH // 2, cy - TILE_HEIGHT // 2))
        if self.step == 2:
            screen.blit(get_sprite(OHNOES2), (cx - TILE_WIDTH // 2, cy - TILE_HEIGHT // 2))

        screen.blit(get_player_sprites()[3][0], (cx, cy))

        light_mask = pg.Surface((screen.get_width(), screen.get_height()), flags=pg.SRCALPHA)
        light_mask.fill(pg.Color(0, 0, 0))

        halo = get_light_halo(self.light)
        light_mask.blit(halo, (cx - self.light + PLAYER_WIDTH // 2,
                               cy - self.light + PLAYER_HEIGHT // 2),
                        special_flags=pg.BLEND_RGBA_MIN)
        screen.blit(light_mask, (0, 0))

        if self.light <= 8:
            from title_screen.title_screen import TitleScreen
            return TitleScreen
Ejemplo n.º 2
0
def _replace_door_bitmap():
    global map_surface
    global closed_door_count
    global closing_door_sequence

    newly_closed_door: Edge = closing_door_sequence[closed_door_count - 1]

    if newly_closed_door.dir == Edge.VERT:
        for i in range(-1, 1):
            room: Room = rooms[newly_closed_door.x + i][newly_closed_door.y]
            tile_i = 6 if i == -1 else 0
            tile_j = DOOR_POSITION
            for tile in room.get_tile(tile_i, tile_j):
                sprite_id = tile.sprite_id
                x_coord = (room.x * ROOM_WIDTH *
                           TILE_WIDTH) + tile_i * TILE_WIDTH
                y_coord = (room.y * ROOM_HEIGHT *
                           TILE_HEIGHT) + tile_j * TILE_HEIGHT
                map_surface.blit(get_sprite(sprite_id), (x_coord, y_coord))

    if newly_closed_door.dir == Edge.HORIZ:
        for i in range(-1, 1):
            room: Room = rooms[newly_closed_door.x][newly_closed_door.y + i]
            tile_i = DOOR_POSITION
            tile_j = 6 if i == -1 else 0
            for tile in room.get_tile(tile_i, tile_j):
                sprite_id = tile.sprite_id
                x_coord = (room.x * ROOM_WIDTH *
                           TILE_WIDTH) + tile_i * TILE_WIDTH
                y_coord = (room.y * ROOM_HEIGHT *
                           TILE_HEIGHT) + tile_j * TILE_HEIGHT
                map_surface.blit(get_sprite(sprite_id), (x_coord, y_coord))
Ejemplo n.º 3
0
def increment_cycles():
    _state.current_horizontal_cycle = (_state.current_horizontal_cycle +
                                       1) % PLAYER_FRAME_ROTATION
    _state.current_paint_cycle = (_state.current_paint_cycle + 1) % (24 * 2)
    _state.paint_level = max(_state.paint_level - 1, 0)
    if _state.paint_level:
        fleft, fright = FOOTPRINTS[_state.paint_color]
        if _state.current_paint_cycle == 0:
            draw_footstep(asset.get_sprite(fleft))
        if _state.current_paint_cycle == 24:
            draw_footstep(asset.get_sprite(fright))
Ejemplo n.º 4
0
 def __init__(self, monster_position: Tuple[int, int]):
     pg.sprite.Sprite.__init__(self)
     self.image_orig: pg.Surface = pg.image.load(os.path.join('assets', 'speech_bubble.png')).convert_alpha()
     self.images = [
         [
             get_sprite(BUBBLE_OO),
             get_sprite(BUBBLE_OF)
         ],
         [
             get_sprite(BUBBLE_FO),
             get_sprite(BUBBLE_FF)
         ]
     ]
     self.monster_position = monster_position
     self.set_image(monster_position)
     self.rect = self.image.get_rect()
     self.burger: pg.Surface = get_sprite(BURGER)
Ejemplo n.º 5
0
    def draw(self, screen):
        if self.threat_bubble:
            self.threat_bubble.draw(screen)

        shadow = get_shadow_halo(240)
        screen.blit(shadow, map.to_screen_coords(self.x - 240, self.y - 240))

        if self.get_distance_to_player(
        ) / TILE_WIDTH < self.warning_sign_active:
            screen.blit(get_sprite(WARNING),
                        map.to_screen_coords(self.x, self.y))
Ejemplo n.º 6
0
def _fill_initial_surface():
    global map_surface

    map_surface = Surface((MAP_WIDTH * ROOM_WIDTH * TILE_WIDTH,
                           MAP_HEIGHT * ROOM_HEIGHT * TILE_HEIGHT))
    room_x = 0

    for room_i in range(0, MAP_WIDTH):
        room_y = 0

        for room_j in range(0, MAP_HEIGHT):
            for tile_i in range(0, ROOM_WIDTH):
                for tile_j in range(0, ROOM_HEIGHT):
                    x_coord = room_x + tile_i * TILE_WIDTH
                    y_coord = room_y + tile_j * TILE_HEIGHT
                    for t in rooms[room_i][room_j].get_tile(tile_i, tile_j):
                        map_surface.blit(get_sprite(t.sprite_id),
                                         (x_coord, y_coord))

            room_y += ROOM_HEIGHT * TILE_HEIGHT
        room_x += ROOM_WIDTH * TILE_WIDTH