A radian is the angle whose arc length is the same length as the circle's radius. For example, if something moves through an arc of 0.4 radians, it'll have moved through a distance 40% of that to the center. If your game has 16-direction movement, there's a gap of (2*Pi/16) = about 0.4 radians between positions. For example, if something has 16 frames of rotation and a lever arm 20 pixels long, the end will move by 8 pixels between one angle and the next.
In this figure, an angle close to 22.5 degrees or 0.4 radians is marked in red, and a distance of 40 percent of the radius is marked in green.
Attachment:
0.4_radians.png [ 3.76 KiB | Viewed 6194 times ]
Now say I have something spinning on an off-center axis, such as a ball on a chain or a character swinging on a trapeze. From the axis of rotation to the active part is 20 pixels. But with 16 frames of animation (8 stored, 8 flipped), that's still about 0.4 radian per frame. So when the object rotates through 1/16 of a circle, its active part instantly moves about 8 pixels, enough to confuse collision detection, eject the object the wrong way, and cause it to glitch through a wall.
Attachment:
all16frames.gif [ 2.14 KiB | Viewed 6194 times ]
Attachment:
File comment: Onion skinned: previous frame semitransparent
all16onion.gif [ 2.88 KiB | Viewed 6194 times ]
I could try shearing the rotating sprite by sliding the 8-pixel strips. This is analogous to how games use "Y offset per column" background modes of the Super NES PPU and Sega Genesis VDP to fake rotation;
psycopathicteen could tell you more about these modes. Sliding each strip by 1 pixel works for up to 1/8 radian (7.16 degrees) either way.
Attachment:
File comment: With one frame of shear before and after each
all48framesfast.gif [ 6.26 KiB | Viewed 6194 times ]
Attachment:
all48framesslow.gif [ 6.26 KiB | Viewed 6194 times ]
Or I could try decoupling the collision position from the display position so that the active part moves smoothly despite discrete angle changes in the sprite.