How to replicate this type of joystick?

ocindahouseocindahouse Member Posts: 24
edited November -1 in Working with GS (Mac)
Can anybody point me in the right direction? My game is going to have 2 separate joysticks for movement, 1 left-right stick n 1 up-down stick, but I want them to work just like the one found in the street fighter template from deep blue apps:

Comments

  • AsymptoteellAsymptoteell Member Posts: 1,362
    When touch is pressed
    Constrain attribute self.position.x to max(furthest point to left, (min(furthest point to the right, mouse.position.x))

    That should do it.
  • ocindahouseocindahouse Member Posts: 24
    Ok, this is what I put on the constrain attribute:

    self.position.x to max(57, (min(148, game.Mouse.Position.X )))

    Now it works perfect. Thanks for that.

    Now, how would I attach it to the movement of the actor? creating an attribute?, if you can give me ideas.....
  • AsymptoteellAsymptoteell Member Posts: 1,362
    Constrain a game attribute to self. position x -91.

    In your actor that moves, constrain attribute self.linearvelocity.x to that game attribute. You'll need to multiply it or divide it by some constant to make it be the right speed. You'll have to experiment, but I think this is what you'll want to do.

    Asymptoteell
  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    I would look at the Volume slider demo from FMG. Search it on GameSalad under new and the only different is I would make all of rules work when touch is pressed and then the otherwise make it pop back into the center. That prob doesn't make much sense but hopefully it helps. Thats where I would start.
  • ocindahouseocindahouse Member Posts: 24
    @tenrdrmer: actually the method Asymptoteell suggests works perfect for me. I did have to tweak it a little bit to make the stick return to its original position after the touch is released but wasnt hard to figure out.

    @Asymptoteell: sir you are a pro. It works as expected. Now, im left with another question. Since the left and right movement are all controlled by 1 action, then how do I kinda separate them both so i can animate when it goes left or when it goes right?
    More like, how can i make GS realize when the actor is moving right so the right-animation starts.

    Thanks for all the help.
Sign In or Register to comment.