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:
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
tenrdrmerMember, Sous Chef, Senior Sous-ChefPosts: 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.
@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.
Comments
Constrain attribute self.position.x to max(furthest point to left, (min(furthest point to the right, mouse.position.x))
That should do it.
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.....
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
@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.