Offset Values for Scrollable scene and mouse coordinates?

My game relies on a user being able to move an object with their finger. This works just fine in the original camera location, but when the camera moves around the scene the locations get all screwed up. Is there a way to make an actor's location where your finger is anywhere in the scene? I'll show you my solution that doesn't seem to work.

I have two actors, the actor to be moved and an offsetter. The offsetter is non-scrollable, 1px in size, and is located in the bottom left of the screen. This actor constantly constrains its position x and y values to two real, global attributes, offset_x and offset_y. When I add these offset values to the x and y values of the mouse position, it doesn't work.

Please fix this solution or give me another one!

(Actor to be moved)
constrain self.position.x to game.mouse.position.x + game.offset_x
constrain self.position.y to game.mouse.position.y + game.offset_y

Thanks!

Best Answer

Answers

Sign In or Register to comment.