в функции coord_calc() не прибавляется speed к now_tile.x. Я уже пробовал и из отрицательного в положительное число переводить, тоже ничего. И простите если это убер нечитабельный код, ибо прогу делаю для себя ничего не зная.
class tile: def __init__(self, x, y, name): self.x = x self.y = y self.name = name now_tile = tile end_tile = tile math_tile = tile speed = 1 tiles = [ tile(1, 1, 'A1'), tile(1, 2, 'A2'), tile(1, 3, 'A3'), tile(1, 4, 'A4'), tile(2, 1, 'A5'), tile(2, 2, 'A6'), tile(2, 3, 'A7'), tile(2, 4, 'A8'), tile(3, 1, 'A9'), tile(3, 2, 'A10'), tile(3, 3, 'A11'), tile(3, 4, 'A12'), tile(4, 1, 'A13'), tile(4, 2, 'A14'), tile(4, 3, 'A15'), tile(4, 4, 'A16') ] for i in tiles: print(f'x,y,ID: {i.x},{i.y}, {i.name}') def coord_find(): global one global now_tile global end_tile global math_tile one = ('A2') two = ('A10') for i in tiles: if i.name == one: now_tile = i if i.name == two: end_tile = i print(now_tile.name, end_tile.name) math_tile.x = now_tile.x - end_tile.x math_tile.y = now_tile.y - end_tile.y print(math_tile.x, math_tile.y) def coord_info(): print(f'Вы идёте из {now_tile.name}, {now_tile.x}, {now_tile.y}') print(f'В {end_tile.name}, {end_tile.x}, {end_tile.y}') print(f'Пути всего: {abs(math_tile.x) + math_tile.y}') def coord_calc(): global now_tile global math_tile global end_tile if now_tile != end_tile: if math_tile.x < 0: print(math_tile.x) now_tile.x += speed else: now_tile.x -= speed else: print('') if now_tile != end_tile: if math_tile.y < 0: now_tile.x += speed else: now_tile.x -= speed else: print('') print(now_tile.x, now_tile.y) coord_find() coord_info() coord_calc()