rotation of items, not using matrix
Posted: Thu Jul 05, 2018 12:53 pm
this function is very similar to TurnBoat (boat, direction), is made to rotate items that are not in an matrix.
there is only the calculation of mathematics.
you can adapt it to receive 1 object or a list.
Code: Select all
//DIRection 1=right, 2=flip, 3=left
my_RotatePoint( who, struct{"x":=item.x,"y":=item.y} , 1);
function my_RotatePoint( byref pivo, byref ponto , dir)
var difx := pivo.x - ponto.x;
var dify := pivo.y - ponto.y;
case (dir)
1: // Right
ponto.x := pivo.x + dify;
ponto.y := pivo.y - difx;
2: // Flip
ponto.x := pivo.x + difx;
ponto.y := pivo.y + dify;
3: // Left
ponto.x := pivo.x - dify;
ponto.y := pivo.y + difx;
endcase
endfunction
you can adapt it to receive 1 object or a list.