Actor constrain to touch position lags/drifts off

PimanPiman Member, PRO Posts: 165
edited January 2012 in Working with GS (Mac)
I have tried to find similar problems here but couldn't find a solution. I have an actor that simply needs to stay "under the finger" at all times, but as the screen scrolls the actor falls behind.

Also after release when I click it again it "jumps back" to an earlier point.

What is going on?

Comments

  • PimanPiman Member, PRO Posts: 165
    edited January 2012
    Thanks for your response, I watched that video thrice and my camera is controlled automatically (scrolls with 100 velocity to the right). :)

    The point is I need the actor that the player controls by touch to be floating along with this speed. This is easily achieved by putting the player controller actor on a separate non scrollable layer... only my problem is... it doesn't interact with the other actors on the other layers anymore but it needs to for the game mechanics...

    How to solve this? I have a form of auto-scroll and all need to have is the actor truly stick under the finger, even if the finger is not moving - then then auto camera scroll defines the position basically.

    (On top of this I also define areas to increase or decrease camera scroll speed to give a feeling of flying faster with a ship - middle of the screen is slower than closer to the edge etc. but again the ship has to stay "under the finger".)

    Help is GREATLY appreciated...stuck on this...

    P.S. I also have rules that say that on touch release the actor does things which don't happen because the actor and finger get separated ...so when you release the finger GameSalad doesn't count it as "release from the actor."

  • PimanPiman Member, PRO Posts: 165
    Anybody? I need my actor to be floating as if on another layer, while the layer below is scrolling - but he also needs to interact with things on the other layer.

    How can I make this work? If I put the actor on the scrolling layer he falls behind when I keep the touch pressed and in one place and so the actor "lags" behind.
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited January 2012
    Hi, by putting your actor into its own layer shouldn't affect interaction with the other layers at all; perhaps there's something else going on there...

    As for your touch release problem, I personally don't understand what you mean: when you release your finger and so it's separated from the actor, that IS touch release, so your Rules should be working with When touch is released.... or perhaps I've misunderstood...

    ----------------------------------------------
    http://davidgriffinapps.co.uk/

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • PimanPiman Member, PRO Posts: 165
    I was being pretty stupid, I now solved this by moving the actors and background to create the illusion of movement while the actor that is held by the touch remains in the same place.

    The other approach still troubles me, here is what I did:

    Constrain actor X to touch
    Have an invisible actor Y move the camera to the right as soon as X was touched (and stop if X was released)

    So Actor X was moving along the scene (a long one) but it would not stay where the touch was, it would "fall behind". Consequently when "released" it didn't trigger "release" anymore because Actor X slipped from under the touch.

    I guess everybody solves this by moving the background rather than the camera + actor movement. I am still curious if I did something wrong or if that simply doesn't work in GameSalad.

    Hyroscope: if I put this Actor X in a layer above all the other objects in a separate layer they can still interact? I had actor X destroy when it would overlap/collide with some of them but it seems that didn't work.


    Okay I just tested various scenarios and it seems there is some weird bug in GameSalad... sometimes the actors in different layers suddenly stop interacting... and I don't see why.
  • PimanPiman Member, PRO Posts: 165
    It seems that my idea of using an invisible actor that drives the camera to the right somehow messes up the registration of where the player controlled actor is, so they interact when the other actor collides with an "old location" of the player actor.

    All I am doing is having actor X (player controller) change an attribute to "touched" and have the camera actor start moving to the right and controlling the camera as soon as this attribute is triggered.
Sign In or Register to comment.