I see... this trick you mention will suit for which type of game ? In my case, it is a strategy game.
I found information about the "line vs box intersection test", concretely, its like the screen below. Seems to be very similar to your suggestion, klaas, but the suggestion of @xyz is interesting.
But some point isn't clear: we agreed one pairs of intersect boxes will be connected, if green and yellow are clean, the case of blue and green shouldn't be connected, despite the condition is true. So what can it be done to avoid that if i'm not supposed to use Bresenham about unpassable cells ?
Next, we have two green boxes, they should intersect but it's not possible with fixes values. So i think i need to use a "multiplier" from distance_to()
, but this method return a float value but i know i have a cell size of 32 x 32 and i need a box size of Vector(x, y). I'm not sure to know how to convert the float to a vector.
If i have a distance of... 4.256 -----> 4.256 / 32 = 0.133, ----> 0,133 * (32/2 = center of the cell) ----> So the vector will be Vector2(2,128, 2,128) so Vector2(2, 2) ?
Maybe a method do this automatically joined withdistance_to()
?
