int x_dir[2][4] = { { 1,0,-1,0 },{0,1,0,-1} };//[0][] = 順時針 [1][] = 逆時針
int y_dir[2][4] = { { 0,1,0,-1 },{1,0,-1,0} };//[0][] = 順時針 [1][] = 逆時針
分別去設定→↓←↑時xy會有的偏移量,然後用一個index去指到當前的方向
碰牆時index = (index+1)%4