I use an imported tilemap made in Tiled for my game. On top of that map I have placed sprites and other tiled objects. Mostly ladders, enemies and powerups.
I also have actions that track the camera to my player. The horizontal tracking use a lerp set to 0,6.
But! Whenever I move my player, all the objects placed over the imported map can’t decide in absolute pixels whey they should be placed on the map. When I stop moving my player, a ladder could decide to be placed on what looks like X 199.80 instead of X 200. If I move again and stop it may look like it ends up in X 199.20.
I think it might have something to do with using the lerp function on the camera, because I don’t recall this visual problem from before when I didn’t use lerp. The problem is that I really want to use a smoother camera tracking…
I think this is connected to selecting “No” at the images “Smooth the image” option in the image bank. I got the impression that makes the images snap to the pixel grid, but then GDevelop objects seem to get confused if camera or objects have non-integer position (GDev moves thing by increments of less than a pixel all the time). You could try rounding your object position or the position of the camera, but I’m not sure if the problem really stems fromo what I described. There could be other reasons for this to happen.
Well, smoothing the images didn’t change anything. But I tried another thing whick did fix this.
First do the lerp thingy but not to the camera X value but to a global variable I named “cam X”.
Then do a ceil (round up) to that variable.
Finally do the now rounded number from “cam X” to the camera X position…