Actor follows touch too fast

mythicappsmythicapps Member Posts: 82
edited November -1 in Working with GS (Mac)
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

Comments

  • mythicappsmythicapps Member Posts: 82
    Hey TSB;

    I want it to be slower. I want to touch it and drag to a location and have it follow slowly.
  • mythicappsmythicapps Member Posts: 82
    Yeah, I tried that, makes no difference at all.
  • mythicappsmythicapps Member Posts: 82
    Ah Ha; that was the case I was using constrain, now it follows my finger. But only so long as my finger (mouse) is down. I want it to follow where my finger has gone from start to finish even when my finger has been removed.

    Thanks
  • mattyr64mattyr64 Member Posts: 82
    yeh it probably only moves to it once. you could set up a rule as follows:

    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.
  • mythicappsmythicapps Member Posts: 82
    mattyr64 said:
    yeh it probably only moves to it once. you could set up a rule as follows:

    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.

    OK, I'll try this tonight.

    So this should allow me to drag a path with my finger and have the actor follow it at a slow speed, correct?
  • mythicappsmythicapps Member Posts: 82
    mattyr64 said:
    yeh it probably only moves to it once. you could set up a rule as follows:

    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.

    OK, I think I am missing some steps here.

    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
  • mythicappsmythicapps Member Posts: 82
    Bump
  • mythicappsmythicapps Member Posts: 82
    OK, I tried the rule as noted above, however I do not know what should fire the change to game.touches.count, also just putting this rule in makes the preview go blank. Here is the rule.

    screen2
  • mattyr64mattyr64 Member Posts: 82
    just touching the screen should increment the count, my rule is setup on my actor that i want to move as follows:

    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
  • mythicappsmythicapps Member Posts: 82
    OK I must be brain dead. I just can't make it work.

    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.
    touches-rule

    Actor TWO (Spaceship), has the rule when attribute"game.touches.count" = 1, timer and move as you noted.
    move rule

    What the heck am I doing wrong, or what is it I am not understanding?
    Thanks
  • mattyr64mattyr64 Member Posts: 82
    sry for the slow reply, i was at work yesterday...

    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.
  • mythicappsmythicapps Member Posts: 82
    Hey Mattry64;

    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.
    movementfollow

    Thanks
  • mattyr64mattyr64 Member Posts: 82
    that first whole rule you have there is not needed. the second rule is right from what i can tell.

    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.
  • mythicappsmythicapps Member Posts: 82
    OK, I removed the first part and your correct, it still works fine.

    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.
  • mattyr64mattyr64 Member Posts: 82
    i'm not 100% on how to move multiple objects, not done it myself.

    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
Sign In or Register to comment.