Non-Joystick Control Help Needed

axehammeredaxehammered Member Posts: 12
edited November -1 in Working with GS (Mac)
Hello,

I want to get my actor to mimic my touch on the screen without actually having to touch the actor. For instance if I move my finger up the screen, I want my actor to move up at the same speed regardless of whether I'm touching the actor or not. Basically, like how a touchpad controls the mouse pointer on a laptop but the screen is my touchpad.

Is this possible with GameSalad, and if so can somebody please point me in the right direction? I've spent many hours trying and failing. I really hope this is possible as its essential for my game.

Thankyou for any help and tips you can give me.

Dean.

Comments

  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,881
    When the mouse is down (or touch is pressed, try constraining the actor's y attribute to the y value of the mouse's (or touch's) y attribute.
  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934


    Follow this video and instead of touch is pressed use mouse button is down. That should work for you.
  • axehammeredaxehammered Member Posts: 12
    Thanks for the fast reply.

    The problem with that is when I constrain an actors X/Y position to the X/Y position of the mouse or touch it immediately takes the actor to where I'm touching. Obviously it follows my finger perfectly like this, but I want to be able to move the actor from a different area of the screen.
  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    Watch the video. It tells you how to fix that. Watch the whole video and When he uses touch is pressed. Use mouse button down.
  • axehammeredaxehammered Member Posts: 12
    tenrdermer,

    Thats not quite what I was after but I think I might be able to get it to do what I want using that technique, so thanks for bringing it to my attention. If I'd known how helpful and friendly you guys were I would have registered much sooner.

    I would still really like to know if there is a way to control an actor like in the above video, but without having to click/touch on the actor itself.
  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    axehammered said:
    I would still really like to know if there is a way to control an actor like in the above video, but without having to click/touch on the actor itself.

    Yes, You can. You use mouse button is down in place of touch is pressed. It will work from anywhere on the screen.

    Everytime he make a rule that says

    Actor Receives event Touch is pressed.

    Change it to…

    Actor Receives event Mouse Button is Down
  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,881
    Your original post indicated that you only wanted to constrain the actor going up and down. If that is the case, they only constrain (self.Position.Y) to (game.Mouse.Position.Y).
  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    RThurman said:
    Your original post indicated that you only wanted to constrain the actor going up and down. If that is the case, they only constrain (self.Position.Y) to (game.Mouse.Position.Y).

    he just used moving up as an example. He said he wants his actor to follow the touch motion even if the touch is not on the actor. The Video and explanation of the modification to the video he needs to make I have provided is Exactly What he needs.
  • axehammeredaxehammered Member Posts: 12
    Ok, my bad. I didn't realise having mouse button down would be so different to touch is pressed. I will try this later when I get the chance.

    And the above is correct, I used up and down as an example. Sorry for any confusion. I'll let you know how I get on.
  • axehammeredaxehammered Member Posts: 12
    Perfect. Does exactly what I wanted. Thanks a million.

    Now I can spend the rest of the day trying to figure out why it does it.
Sign In or Register to comment.