コード例 #1
0
ファイル: demo_starship.py プロジェクト: rkibria/yapyg
def start_stars_movement(state, mover_name):
        int_screen_width = int(screen.get_width(state))
        int_screen_height = int(screen.get_height(state))
        for x in xrange((int_screen_width / 256) + 1):
                for y in xrange((int_screen_height / 256) + 2):
                        entity_name = star_name(x, y)
                        jump_mover.add(state, entity_name, ((x * 2), (y * 2), 0))
                        linear_mover.add(state, entity_name, (0, -2), 0.25)
        wait_mover.add(state, entity_name, 0, start_stars_movement)
コード例 #2
0
def start_stars_movement(state, mover_name):
    int_screen_width = int(screen.get_width(state))
    int_screen_height = int(screen.get_height(state))
    for x in xrange((int_screen_width / 256) + 1):
        for y in xrange((int_screen_height / 256) + 2):
            entity_name = star_name(x, y)
            jump_mover.add(state, entity_name, ((x * 2), (y * 2), 0))
            linear_mover.add(state, entity_name, (0, -2), 0.25)
    wait_mover.add(state, entity_name, 0, start_stars_movement)
コード例 #3
0
ファイル: entities_helpers.py プロジェクト: rkibria/yapyg
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)
コード例 #4
0
ファイル: entities_helpers.py プロジェクト: hanez/yapyg
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,
    )