Ejemplo n.º 1
0
def link_direction_test():
    loc1 = (5, 5)
    # north
    loc2 = (5, 6)
    ok_(map_gen.link_direction(loc1, loc2) == 's')
    # north-east
    loc2 = (6, 6)
    ok_(map_gen.link_direction(loc1, loc2) == 'se')
    # east
    loc2 = (6, 5)
    ok_(map_gen.link_direction(loc1, loc2) == 'e')
    # south-east
    loc2 = (6, 4)
    ok_(map_gen.link_direction(loc1, loc2) == 'ne')
    # south
    loc2 = (5, 4)
    ok_(map_gen.link_direction(loc1, loc2) == 'n')
    # south-west
    loc2 = (4, 4)
    ok_(map_gen.link_direction(loc1, loc2) == 'nw')
    # west
    loc2 = (4, 5)
    ok_(map_gen.link_direction(loc1, loc2) == 'w')
    # north-west
    loc2 = (4, 6)
    ok_(map_gen.link_direction(loc1, loc2) == 'sw')
Ejemplo n.º 2
0
def get_exit_dir(s1, s2):
    """ Return exit direction from s1 to s2. s1 and s2 are Scene objects."""
    return map_gen.link_direction(s1.location, s2.location)