I seem to be having a problem with fixed movement and rotate. I’ll try to articulate the problem the best I can.
I am making a WRG style miniatures game. I want the unit to rotate 360 points. I also want it or a group to be able to recoil a fixed distance…or to be able to move directly forward, left or right 1 point with the press of a key (CTL F, CTL L, CTL R).
When I make small turns, the unit will only go forward to the top of the screen. When I make square turns (90 180 270) the unit moves correctly.
I am wondering if this is a problem with rounding ff coordinates (limitation) or if this is a bug. The movement performs much better when I use larger numbers. For instance. If I set move to 30 points forward, it seem to move better but not necessarily in the exact direction indicated.
That would seem to indicate that the distance moved is part of the
problem.
With a very short movement, there isn’t really a lot that can be done
as far as moving the unit while still having it retain integer
coordinates.
To make a quick picture, look at the following:
±–±–±–+
| a | b | c |
±–±–±–+
| | X | |
±–±–±–+
With what is fundamentally a square grid, the only movement
possibilities for a 1 unit move generally upward from “X” are “a”, “b”
or “c”. So, if you have a counter that is rotated 5°, and it moves
one unit, it will have to go to “b”, and not to “c”. You would start
getting movement to “c” once the angle gets big enough. But
effectively, you can only have 8 different directions for a 1 step move.
I would have thought that moves of around 30 or so would give you a
lot better resolution, down to around 2 degrees. (Ï€ x 30 x 2 ~ 180)
The larger movement does work pretty well. However, it is noticeably off though. So for stuff like recoiling/retreating, it will work well enough. All other movement will have to be free-form I suppose.