Jittery sprites with my camera zoom function

Published 2023-06-12

i've tried to make a function that scales and offsets sprites to simulate a camera zoom. The way it works is by pressing z and x will increase or decrease the pixel size, each object has x and y values, and sx and sy which are scaled and offset based on the pixel size value.

in this demo the black cats are based on the x and y values, the blue cats are based on the sx and sy values. The scaled blue cats movement is very jittery, especially when accelerating and decelerating, the non scaled black cats are not jittery.

So I think the controls are changing the x and y values correctly, and there isn't a problem with the camera being out of sync, it must be a problem with getting the sx and sy values from my x and y ones. Looking at it, it is like they are not moving in unison, instead the movement is rippling through the objects one by one.

it is the scale_x and scale_y functions that create the sx and sy, and these functions are called in the 'move' function

Any idea what I am doing wrong?

thanks