Follow my finger!
![Cuckoohead](http://forums.gamesalad.com/applications/dashboard/design/images/defaulticon.png)
Hello everyone! I'm working on a sort of rpg game for the iPhones and I'm having a bit of trouble getting my character to move correctly. What I'm trying to achieve is something as follows: I want the character to move to a spot where your touch was released—after you've pressed on the inside of the character and dragged your finger to a specific location.
I want it to go at a set pace, without accelerating.
Again; movement can only be initiated if the character is pressed from the inside and then released on the outside. Is this possible? I know there have been many posts asking similar questions (many of which I've read, and tried), but none of them seem to work the way I want them to. If someone could give me an answer on how to accomplish this it would be much appreciated!!!
Thanks in advance!
I want it to go at a set pace, without accelerating.
Again; movement can only be initiated if the character is pressed from the inside and then released on the outside. Is this possible? I know there have been many posts asking similar questions (many of which I've read, and tried), but none of them seem to work the way I want them to. If someone could give me an answer on how to accomplish this it would be much appreciated!!!
Thanks in advance!
Comments
in the player have a rule when actor recieves event touch is pressed change move on to 1
have another rule in the player when attribute move on=1 AND touch is outside AND touch is released
interpolate self position x to mouse position x
interpolate self position y to mouse position y
change attribute moveon to 0
cheers
See any problems?
This is harder to accomplish than I thought.
I had it moving to wherever I clicked using two constrain attributes, earlier. I liked the way it responded, however, my character would move WHENEVER I clicked on the screen. When I'd try to click on some of her abilities in the action bar I created, she'd move to the button. I'm trying to find a way to only make her movable if she is touched and the dragged to a location...
The touch is outside the actor And the touch is released ..hmm this doesn't seem right because how can you touch and release at the same time?
So let's think of something else.
Try to create the 2nd rule in a different way
Create a rule when touch is pressed and Move on is 1 then put another rule in the behavior section and say when touch released then move actor.
Try it and let me if it works.
Mo
The two behaviors I have in my character are:
1. A rule that changes attribute "move on" to 1 when touch is pressed.
2. A rule that is activated when both touch is pressed AND "move on" is equal to 1. Within this rule is another rule with two interpolate attributes (one that interpolates Self.Position.X to Mouse.Position.X, and one that interpolates Self.Position.Y to Mouse.Position.Y. They are both set to function linearly, with a duration of 1), bellow the interpolate attributes is a change attribute that changes "move on" back to 0.
There are no "otherwise" settings in any of my rules.
Can you see what could be the problem? I don't understand what I'm doing wrong. It seems logical enough :P
Let's do it again.
1. click on on the actor to unlock it and change the instance not the prototype.
2. Rule 1 ( when touch is pressed then set Move on to 1 )
2. Rule 2 ( when Move On is 1 and touch is outside then add another rule within that says ( when touch is released then display text "WORKS" )
Let's do this see if this works then we will change the last rule.
Mo
Let's do it again.
1. click on on the actor to unlock it and change the instance not the prototype.
2. Rule 1 ( when touch is pressed then set Move on to 1 )
3. Rule 2 ( when Move On is 1 and touch is outside then add another rule within that says ( when touch is released then display text "WORKS" )
Let's do this see if this works then we will change the last rule.
Mo
This sure is mind boggling! But fun in a weird way, too. I'm so glad you are helping me with this! I appreciation it tremendously!
Add an actor to scene and make it display the Move On attribute to see if this guy changes.
Mo
http://www.mediafire.com/?wqdbr2np21yg735
if you have any questions feel free to ask
cheers
then one more rule when self position x and y = targetx and targety
change attribute move on to 0 (move on attribute is from my older post)
that shuts it all down and resets for the next touch and drag
and incase your wondering mouse position x and touch x are the same thing on the device. It reads both the same
cheers