Moving actor in the opposite direction of the touch

HunnenkoenigHunnenkoenig Member Posts: 1,173
edited November -1 in Working with GS (Mac)
I have absolutely no idea, how I could realise that. Maybe somebody can give me a tip.

I want to move an actor exactly in the opposite direction, as the player moves his finger.

It is for the wall breaker game and I want to move the racket the other direction as it would normally move.

My self.position.X is constrained and I have set it to a min/max to stop at the frame of the screen.

A move behaviour is not the option, I think. It should be some scripting, but I don't know, how to acomplish that.
Any help would be appreciated :-)

Comments

  • StormyStudioStormyStudio United KingdomMember Posts: 3,989
    ok, just made a project and tested it....it works, but you have to use mouse down rather than touch (or have a transparent layer over the whole thing with a rule on).

    Rule
    if mouse is down,

    move to touch 1postion x and touch 1 position y

    at a negative speed so -100

    download project from here:
    http://gamesalad.com/game/play/44586

    Although it is mouse down, that should work fine on the iphone as well

    hopefull won't be affected by the other thing you have going on already.
  • HunnenkoenigHunnenkoenig Member Posts: 1,173
    Thanks!

    It is not exactly what I wanted though.

    Normally I have the mouse position X constrained to the actor's position X, so you can pull the actor back and forth and it moves with the mouse (your finger).

    Now I need exactly the same ting, but in the opposite direction. If I move my finger to the right, the actor moves to the left, but exactly as much as my finger moves.

    So if I move my finger 1cm to the right, the actor moves 1cm to the left.
  • EastboundEastbound Member, BASIC Posts: 1,074
    Or since you are constraining the X, whenever the reverse power up is in effect, constrain x to:

    scene_width - mouse or touch position's x

    Should reverse the movement, or at least it does in my head :p
  • StormyStudioStormyStudio United KingdomMember Posts: 3,989
    ok, what eastbound says sounds like a plan...
  • HunnenkoenigHunnenkoenig Member Posts: 1,173
    Thanks to both of you.

    I will try and report back.
  • HunnenkoenigHunnenkoenig Member Posts: 1,173
    EASTBOUND YOU ARE MY HERO FOR THE DAY!!!!!!

    Sorry for screaming, but you made me very happy!
Sign In or Register to comment.