Move camera with touch

jsorr2jsorr2 Member Posts: 279

I have code set up to move the camera with touch, however it's inverted for some reason. my logic is this:

When touch is pressed in actor as big as scene (1136 x 320)

change attribute -> self.Difference TO game.touches.touch1.X - scene.camera.origin.X

constrain -> scene.camera.origin.x TO game.touches.touch1.x - self.diff

The problem is, the camera moves inverted, but is perfect otherwise. If i swap to self.diff-touch.x the camera moves the way i want it too, however, when touch is pressed again the camera jolts to a new location (if it was at 140, it moves to -140) instead of staying still until touch changes.

Best Answer

Answers

Sign In or Register to comment.