Ejemplo n.º 1
0
def Create():
    global delete_idx
    if mode == 't' and kind == 1:
        # basic tile
        tiles.append(tile_class.TILE(x, y, size_x, size_y, 1))
        tile_x.append(x + camera_x)
        tile_y.append(y)
        tile_mode.append(1)
        delete_idx = "tile"
    elif mode == 't' and kind == 2:
        # tile2
        tiles.append(tile_class.TILE(x, y, size_x, size_y, 2))
        tile_x.append(x + camera_x)
        tile_y.append(y)
        tile_mode.append(2)
        delete_idx = "tile"
    elif mode == 't' and kind == 3:
        # tile3
        tiles.append(tile_class.TILE(x, y, size_x, size_y, 3))
        tile_x.append(x + camera_x)
        tile_y.append(y)
        tile_mode.append(3)
        delete_idx = "tile"
    elif mode == 'o' and kind == 1:
        # triangle obstacle
        tri_obses.append(obstacle_class.OBSTACLE_TRIANGLE(x, y))
        tri_obs_x.append(x + camera_x)
        tri_obs_y.append(y)
        delete_idx = "tri_obs"

    pass
Ejemplo n.º 2
0
def ReadPos():
    global tile_x, tile_y, tile_mode, tri_obs_x, tri_obs_y, tiles, tri_obses
    f = open('stage3_tile_pos.txt', mode='rt')
    # tile pos read
    while True:
        line = f.readline()
        line.strip('\n')
        if line == 'end\n' or (not line) or line == '':
            break
        tile_x.append(float(line))
        line = f.readline()
        line.strip('\n')
        if line == 'end\n' or (not line) or line == '':
            break
        tile_y.append(float(line))
        line = f.readline()
        line.strip('\n')
        if line == 'end\n' or not line or line == '':
            break
        tile_mode.append(int(line))
        if tile_mode[len(tile_mode) - 1] == 1:
            tiles.append(
                tile_class.TILE(tile_x[len(tile_x) - 1],
                                tile_y[len(tile_x) - 1], 100, 100, 1))
        elif tile_mode[len(tile_mode) - 1] == 2:
            tiles.append(
                tile_class.TILE(tile_x[len(tile_x) - 1],
                                tile_y[len(tile_y) - 1], 70, 20, 2))
        elif tile_mode[len(tile_mode) - 1] == 3:
            tiles.append(
                tile_class.TILE(tile_x[len(tile_x) - 1],
                                tile_y[len(tile_y) - 1], 70, 20, 3))

    f2 = open('stage3_triangle_obs_pos.txt', mode='rt')
    # triangle obstacle pos read
    while True:
        line = f2.readline()
        line.strip('\n')
        if line == "end\n" or not line or line == '':
            break
        tri_obs_x.append(float(line))

        line = f2.readline()
        line.strip('\n')
        if line == 'end\n' or not line or line == '':
            break
        tri_obs_y.append(float(line))

        tri_obses.append(
            obstacle_class.OBSTACLE_TRIANGLE(tri_obs_x[len(tri_obs_x) - 1],
                                             tri_obs_y[len(tri_obs_y) - 1]))

    f.close()
    f2.close()
def ReadPos():
    f = open('stage3_tile_pos.txt', mode='rt')
    # tile pos read
    while True:
        line = f.readline()
        line.strip('\n')
        if line == 'end\n' or (not line) or line == '':
            break
        tile_x = float(line)
        line = f.readline()
        line.strip('\n')
        if line == 'end\n' or (not line) or line == '':
            break
        tile_y = float(line)
        line = f.readline()
        line.strip('\n')
        if line == 'end\n' or not line or line == '':
            break
        tile_mode = int(line)
        if tile_mode == 1:
            tiles.append(tile_class.TILE(tile_x, tile_y, 100, 100, 1))
        elif tile_mode == 2:
            tiles.append(tile_class.TILE(tile_x, tile_y, 70, 20, 2))
        elif tile_mode == 3:
            tiles.append(tile_class.TILE(tile_x, tile_y, 70, 20, 3))

    f2 = open('stage3_triangle_obs_pos.txt', mode='rt')
    # triangle obstacle pos read
    while True:
        line = f2.readline()
        line.strip('\n')
        if line == "end\n" or not line or line == '':
            break
        tri_obs_x = float(line)
        line = f2.readline()
        line.strip('\n')
        if line == 'end\n' or not line or line == '':
            break
        tri_obs_y = float(line)
        triangle_obstacles.append(
            obstacle_class.OBSTACLE_TRIANGLE(tri_obs_x, tri_obs_y))

    f.close()
    f2.close()
Ejemplo n.º 4
0
def ReadPos():
    global tile_x, tile_y, rect_obs_mode, rect_obs_x, rect_obs_y, tiles, rect_obses
    f = open('stage2_tile_pos.txt', mode='rt')
    # tile pos read
    while True:
        line = f.readline()
        line.strip('\n')
        if line == 'end\n' or (not line) or line == '':
            break
        tile_x.append(float(line))
        line = f.readline()
        line.strip('\n')
        if line == 'end\n' or (not line) or line == '':
            break
        tile_y.append(float(line))
        tiles.append(
            tile_class.TILE(tile_x[len(tile_x) - 1], tile_y[len(tile_x) - 1],
                            100, 100, 1))

    f2 = open('rect_obs_pos.txt', mode='rt')
    # rectangle obstacle pos read
    while True:
        line = f2.readline()
        line.strip('\n')
        if line == "end\n" or not line or line == '':
            break
        rect_obs_x.append(float(line))

        line = f2.readline()
        line.strip('\n')
        if line == 'end\n' or not line or line == '':
            break
        rect_obs_y.append(float(line))

        line = f2.readline()
        line.strip('\n')
        if line == 'end\n' or not line or line == '':
            break
        rect_obs_size.append(float(line))

        line = f2.readline()
        line.strip('\n')
        if line == 'end\n' or not line or line == '':
            break
        rect_obs_mode.append(int(line))

        rect_obses.append(
            rectangle_obstacle_class.RECTANGLE_OBSTCLE(
                rect_obs_x[len(rect_obs_x) - 1],
                rect_obs_y[len(rect_obs_y) - 1],
                rect_obs_size[len(rect_obs_size) - 1],
                rect_obs_mode[len(rect_obs_mode) - 1]))

    f.close()
    f2.close()
def ReadPos():
    f = open('stage2_tile_pos.txt', mode='rt')
    # tile pos read
    while True:
        line = f.readline()
        line.strip('\n')
        if line == 'end\n' or (not line) or line == '':
            break
        tile_x = float(line)
        line = f.readline()
        line.strip('\n')
        if line == 'end\n' or (not line) or line == '':
            break
        tile_y = float(line)
        tiles.append(tile_class.TILE(tile_x, tile_y, 100, 100, 1))

    f2 = open('rect_obs_pos.txt', mode='rt')
    # rectangle obstacle pos read
    while True:
        line = f2.readline()
        line.strip('\n')
        if line == "end\n" or not line or line == '':
            break
        rect_obs_x = float(line)

        line = f2.readline()
        line.strip('\n')
        if line == 'end\n' or not line or line == '':
            break
        rect_obs_y = float(line)

        line = f2.readline()
        line.strip('\n')
        if line == "end\n" or not line or line == '':
            break
        rect_obs_size = float(line)

        line = f2.readline()
        line.strip('\n')
        if line == "end\n" or not line or line == '':
            break
        mode = int(line)
        rectangle_obstacles.append(
            rectangle_obstacle_class.RECTANGLE_OBSTCLE(rect_obs_x, rect_obs_y,
                                                       rect_obs_size, mode))

    f.close()
    f2.close()
Ejemplo n.º 6
0
def Create():
    global delete_idx
    if mode == 't' and kind == 1:
        # basic tile
        tiles.append(tile_class.TILE(x, y, size_x, size_y, 1))
        tile_x.append(x + camera_x - 10)
        tile_y.append(y)
        delete_idx = "tile"
    elif mode == 'o' and kind == 1:
        # triangle obstacle
        rect_obses.append(
            rectangle_obstacle_class.RECTANGLE_OBSTCLE(x, y, size_x, 1))
        rect_obs_x.append(x + camera_x - 10)
        rect_obs_y.append(y)
        rect_obs_size.append(size_x)
        rect_obs_mode.append(obs_mode)
        delete_idx = "rect_obs"
    elif mode == 'o' and kind == 2:
        # triangle obstacle
        rect_obses.append(
            rectangle_obstacle_class.RECTANGLE_OBSTCLE(x, y, size_x, 1))
        rect_obs_x.append(x + camera_x - 10)
        rect_obs_y.append(y)
        rect_obs_size.append(size_x)
        rect_obs_mode.append(obs_mode)
        delete_idx = "rect_obs"
    elif mode == 'o' and kind == 3:
        # triangle obstacle
        rect_obses.append(
            rectangle_obstacle_class.RECTANGLE_OBSTCLE(x, y, size_x, 1))
        rect_obs_x.append(x + camera_x - 10)
        rect_obs_y.append(y)
        rect_obs_size.append(size_x)
        rect_obs_mode.append(obs_mode)
        delete_idx = "rect_obs"
    elif mode == 'o' and kind == 4:
        # triangle obstacle
        rect_obses.append(
            rectangle_obstacle_class.RECTANGLE_OBSTCLE(x, y, size_x, 1))
        rect_obs_x.append(x + camera_x - 10)
        rect_obs_y.append(y)
        rect_obs_size.append(size_x)
        rect_obs_mode.append(obs_mode)
        delete_idx = "rect_obs"
    elif mode == 'o' and kind == 5:
        # triangle obstacle
        rect_obses.append(
            rectangle_obstacle_class.RECTANGLE_OBSTCLE(x, y, size_x, 1))
        rect_obs_x.append(x + camera_x - 10)
        rect_obs_y.append(y)
        rect_obs_size.append(size_x)
        rect_obs_mode.append(obs_mode)
        delete_idx = "rect_obs"
    elif mode == 'o' and kind == 6:
        rect_obses.append(
            rectangle_obstacle_class.RECTANGLE_OBSTCLE(x, y, size_x, 2))
        rect_obs_x.append(x + camera_x - 10)
        rect_obs_y.append(y)
        rect_obs_size.append(size_x)
        rect_obs_mode.append(obs_mode)
        delete_idx = "rect_obs"

    pass