Camera offset causing actor to move continuously

rchangrchang Member Posts: 3
edited November -1 in Working with GS (Mac)
Hello,
I following this great tutorial to have an actor follow the mouse/touch for a game scene that is bigger than the screen size:
Camera Offset: following mouse or touch in large scenes using GameSalad
http://www.youtube.com/user/GameSaladCookbook/#p/search/4/bfKYqsuNgXY
In short, it uses the camera's x and y offset to get the actor to move to the correct point.
This mostly works except that if the user touches and holds down on a point on the far right of the screen, the camera moves, which changes the camera offsets and thus the coordinates touched, and the actor KEEPS moving to the right, never getting to its destination touch.

I would like the actor to stop moving but if I'm using camera offsets, and having the actor continuously follow the mouse/touch, I'm not sure this is possible.

Any ideas?
Thanks!

Comments

  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    do you have run to completion checked and are you relative to the scene or actor?
  • rchangrchang Member Posts: 3
    Hi tenrdrmer,
    There is no completion checked or relative to actor/scene to check.

    I use constrain attribute behavior for the actor:
    constrain: self.Motion.Linear Velocity X
    to : self.Speed *(( game.Mouse.Position.X + game.camX )- self.Position.X )

    where camX and camY are constrained to the camera offset x and y.

    I found this technique on the forums for following the mouse pointer.
    Thanks!
    Rich
Sign In or Register to comment.