Esempio n. 1
0
def load_walls(state, base_name, background_file, tile_file, with_collisions=True):
        """
        TODO
        """
        tile_size = screen.get_tile_size(state)
        int_tile_size = int(tile_size)
        background_texture = Image(source=background_file).texture
        walls_texture = Image(source=tile_file).texture
        for tile_name, origin_xy, collision in tiles_origin_table:
                full_tile_name = base_name + tile_name
                wall_texture = walls_texture.get_region(
                        origin_xy[0] * int_tile_size,
                        origin_xy[1] * int_tile_size,
                        int_tile_size,
                        int_tile_size)

                tile_texture = Texture.create(size=(int_tile_size, int_tile_size), colorfmt='rgba')
                fbo = Fbo(size=(int_tile_size, int_tile_size), texture=tile_texture)
                with fbo:
                        Color(1, 1, 1)
                        Rectangle(pos=(0, 0), size=tile_texture.size, texture=background_texture)
                        Rectangle(pos=(0, 0), size=tile_texture.size, texture=wall_texture)
                fbo.draw()
                if not with_collisions:
                        collision = None
                tiles.add_tile_def(state, full_tile_name, tile_texture, collision)
Esempio n. 2
0
def create_screen_wall(
    state,
    base_name,
    border_thickness,
    border_offset,
    bottom_y,
    top=True,
    bottom=True,
    left=True,
    right=True,
    color=(1, 1, 1),
):
    """
        TODO
        """
    screen_width = screen.get_width(state)
    screen_height = screen.get_height(state)
    tile_size = screen.get_tile_size(state)

    pos = (-border_thickness + border_offset, -border_thickness + bottom_y + border_offset)
    size_w = (screen_width / tile_size) + (2.0 * border_thickness) - (2.0 * border_offset)
    size_h = (screen_height / tile_size) - bottom_y + (2.0 * border_thickness) - (2.0 * (border_offset))

    create_collision_box(state, base_name, pos, (size_w, size_h), border_thickness, top, bottom, left, right, color)
Esempio n. 3
0
def create_screen_wall(state,
                       base_name,
                       border_thickness,
                       border_offset,
                       bottom_y,
                       top=True,
                       bottom=True,
                       left=True,
                       right=True,
                       color=(1, 1, 1)):
    """
        TODO
        """
    screen_width = screen.get_width(state)
    screen_height = screen.get_height(state)
    tile_size = screen.get_tile_size(state)

    pos = (-border_thickness + border_offset,
           -border_thickness + bottom_y + border_offset)
    size_w = ((screen_width / tile_size) + (2.0 * border_thickness) -
              (2.0 * border_offset))
    size_h = ((screen_height / tile_size) - bottom_y +
              (2.0 * border_thickness) - (2.0 * (border_offset)))

    create_collision_box(
        state,
        base_name,
        pos,
        (size_w, size_h),
        border_thickness,
        top,
        bottom,
        left,
        right,
        color,
    )