Actor follows touch too fast
![mythicapps](http://forums.gamesalad.com/applications/dashboard/design/images/defaulticon.png)
Hey All;
I have an actor setup with rules to allow it to follow a touch on the screen. It works great, but it follows at exactly the same speed that I move my touch. How to I make it move slower than my touch?
Thanks
I have an actor setup with rules to allow it to follow a touch on the screen. It works great, but it follows at exactly the same speed that I move my touch. How to I make it move slower than my touch?
Thanks
Comments
I want it to be slower. I want to touch it and drag to a location and have it follow slowly.
Thanks
RULE:
when attribute, game.Touches.Count = 1
MOVE TO:
positionX, game.Touches.Touch 1.X
positionY, game.Touches.Touch 1.Y
relative to scene
check run to completion
set speed to what you want.
now whenever you touch the screen it will move to touch.
So this should allow me to drag a path with my finger and have the actor follow it at a slow speed, correct?
What increments game.touches.count to 1?
My move rule shows:
When attribute game.game.touches.count = 1
game.Mouse.Position.X game.game.touches.count 1.X
game.Mouse.Position.Y game.game.touches.count 1.Y
Relative to scene, run to completion.
Is this correct?
If I manually increment the game.touches.count to 1 when I do a preview I get a blank screen.
Thanks
http://dl.dropbox.com/u/4632724/stuff/ruleForTouch.jpg
edit: just noticed you said about it following your finger as its dragged along the screen... this will do that, if it catches up with your finger you have to release and touch again. so as long as your stay ahead of it with your finger, it will keep following.
if you want it to keep re-following touch even when it has caught up with you, you could add in a little timer that checks every 0.1 of a second or so...
like this: http://dl.dropbox.com/u/4632724/stuff/keepTouch.jpg
- Matty
I made a new GS game file to test this on.
I made a game attribute "game.touches.count", it's integer starting at 0.
Actor ONE is not visible and is the size of the screen, it has the rule "When actor touch is pressed", change attribute "game.touches.count" to "game.touches.count" 1.
Actor TWO (Spaceship), has the rule when attribute"game.touches.count" = 1, timer and move as you noted.
What the heck am I doing wrong, or what is it I am not understanding?
Thanks
solution time
you dont make an attribute 'game.touches.count' , it's already there. it is built in, so i think that is where you are going wrong.
in the attribute browser, go to: Devices > Touches > Count
then
in the box next to it, you say equal to 1.
the rules should all be in the actor that you want to move.
That helped a lot, I got it almost working perfectly now, my only missing part is when I stop the touch, the ship keeps following the cursor until it catches up. I would like it to follow up to the point where the touch was released.
It confuses me since on an iOS device there is no cursor, so does that mean that on the iPad, once I stop touching, the ship will go to that last point (where touch was released) and wait there, until touched again?
Here is the complete rule.
Thanks
if you want it to stop moving as soon as you release, then remove the timer, and on the 'move to' rule, just uncheck run to completion, and then as soon as you release it should stop moving.
But if I remove the timer then the ship only moves as long as the touch is present, then it stops. I would like it to start moving with the touch, and move to where the touch was when it was released. In other words follow the path drawn by the touch.
So the ship spawns, you touch it and drag your finger to give it a path to follow, it follows that as whatever speed I have set for that ship. As it is following the path, another ship spawns and you repeat for that ship.
on your previous post you made it sound like you wanted the object to stop moving as soon as the touch was released, that is why i said remove the timer and uncheck 'run to completion' - if you want them to carry on moving to where you last touched, leave it as it was. but with the first rule removed.
someone else may have experience with moving multiple objects though...
- matty