AdamAtomic/flixel — Issue #199: FlxCamera follow shifts 1 pixel when crossing the +/- border
Author: mouseas
Created: 2011-11-04 06:45:22+00:00
State: open

I know, you're thinking "Just 1 pixel? Really? You're reporting a bug about 1 pixel?"

I have a camera following my player without any lerp (or whatever it's called these days), and I noticed when the player crosses x=0 or y=0 (from negative to positive or positive to negative), the player's sprite moves a pixel. I expected the sprite to not shift at all.

To reproduce this bug, create an sprite, and tell the camera to follow it. Set its position to something other than (0,0), and set its velocity such that it will cross either the x=0 line or the y=0 line. Watch closely, and you'll notice the shift when it crosses the line.

I suspect the problem has something to do with how Flixel rounds or casts numbers to integers to achieve its pixellated look. Perhaps when 1 > x > -1, it gets rounded to 0 for display?

One thing to check with this, is whether it is a zoomed pixel, or a screen pixel. Since my game's zoom is 1, I had no way of telling visually.