How Do You Make An Actor Follow Your Finger?

Please help. I need to be able to touch and hold on the actor, then when you move your finger, the actor follows. Anyone know how to do that. If you know ANYTHING AT ALL about this pleasepleasepleaseplease help me.

Thanks in advance.

P.S. This is a school project so just post anything I need the info quick.

Comments

  • Dazza006Dazza006 Member Posts: 248
    edited April 2013
    I will make a quick demo for you give me 5
  • LittleGreenGamesLittleGreenGames Member Posts: 20
    Thanks a ton Dazza006
  • LeonardDeveloperLeonardDeveloper Member Posts: 4,630
    edited April 2013
    Hi,
    I made a free template a while ago
    Here it is: http://www.thermo-apps.com/forums/discussion/7/follow-my-finger-tutorial
    Enjoy!
    LD

    *EDIT*
    Here it is below:
    Here is the project file of this in action: http://thermo-apps.com/wp-content/uploads/2012/07/touchfollowerbythermoapps.zip

    Tutorial Step-by-Step
    1.Select an actor you would like to have this control over/Perform the action on
    2. (Optional) Create walls so they actor doesn't go flying off the screen
    3. Add two "Constrain Attribute" behaviors to the actor,
    4. Then you want to have in the first box of the first "constrain attribute behavior" the text as follows " "self.motion.linear velocity.x" You can enter this by pressing the expression editor button and clicking "actorName"> "Motion">Linear velocity x
    5. Then in the second box you want: "game.Touches.Touch 1.X - self.Position.X" You can find this by pressing the expression editor button and clicking "game>Touches>Touch 1.X>self.Position.X
    6. Then repeat the same for the second behavior but this time using "self.motion.linear velocity.y" instead of "self.motion.linear velocity.y"
  • LittleGreenGamesLittleGreenGames Member Posts: 20
    Thank you SOSOSOSOSO much LeonardDeveloper!
  • LittleGreenGamesLittleGreenGames Member Posts: 20
    Thanks for the edit LeonardDeveloper.
  • Dazza006Dazza006 Member Posts: 248
    Looks like LeonardDeveloper has beat me to it, lol
    hope your project works out. :P
  • LittleGreenGamesLittleGreenGames Member Posts: 20
    Thanks anyway Dazza006.
  • LittleGreenGamesLittleGreenGames Member Posts: 20
    LeonardDeveloper, how do you get "self.motion.linear velocity.y"? I can only get "x".
  • LittleGreenGamesLittleGreenGames Member Posts: 20
    Hi,
    I made a free template a while ago
    Here it is: http://www.thermo-apps.com/forums/discussion/7/follow-my-finger-tutorial
    Enjoy!
    LD

    *EDIT*
    Here it is below:
    Here is the project file of this in action: http://thermo-apps.com/wp-content/uploads/2012/07/touchfollowerbythermoapps.zip

    Tutorial Step-by-Step
    1.Select an actor you would like to have this control over/Perform the action on
    2. (Optional) Create walls so they actor doesn't go flying off the screen
    3. Add two "Constrain Attribute" behaviors to the actor,
    4. Then you want to have in the first box of the first "constrain attribute behavior" the text as follows " "self.motion.linear velocity.x" You can enter this by pressing the expression editor button and clicking "actorName"> "Motion">Linear velocity x
    5. Then in the second box you want: "game.Touches.Touch 1.X - self.Position.X" You can find this by pressing the expression editor button and clicking "game>Touches>Touch 1.X>self.Position.X
    6. Then repeat the same for the second behavior but this time using "self.motion.linear velocity.y" instead of "self.motion.linear velocity.y"
    How do you get "self.motion.linear velocity.y"? All I can get is "x".
  • LeonardDeveloperLeonardDeveloper Member Posts: 4,630
    edited April 2013
    @ebarr24 Your welcome
    @Dazza006 Apologies :)
    @ebarr24
    Follow the project file and youll figure out how I got .y

    Hope it helps,
    LD
  • LittleGreenGamesLittleGreenGames Member Posts: 20
    OK thanks again to both of you! >:D<
  • LeonardDeveloperLeonardDeveloper Member Posts: 4,630
    Haha,
    No bother man
  • Dazza006Dazza006 Member Posts: 248
    You could just say when touch is pressed
    constrain self position X to mouse position X
    constrain self position Y to mouse position Y
  • LeonardDeveloperLeonardDeveloper Member Posts: 4,630
    It works better cross-platform via the method I posted
  • findmattgamesfindmattgames Member, PRO Posts: 100
    Thanks for this! However, it's really slow to catch up. How do I make the movement of the actor as quick as my finger - basically a 1:1 movement where it stays under my finger, not lagging behind?
  • Braydon_SFXBraydon_SFX Member, Sous Chef, Bowlboy Sidekick Posts: 9,273
    @findmattox - Constrain the actors self position X and Y to game.Mouse.PositionX and game.Mouse.PositionY
  • findmattgamesfindmattgames Member, PRO Posts: 100
    Hi Braydon! Thanks for the suggestion, but now I can't move the actor at all. Any idea?


  • KevinCrossKevinCross London, UKMember Posts: 1,894
    edited August 2013
    Did you pick the mouse position from the expression menu or type it in manually. It won't work if typed in manually and the dot is also missing from between positionX and positionY in the example above, it should be position.X and position.Y.

    It should work
  • SocksSocks London, UK.Member Posts: 12,822
    edited August 2013
    Hi Braydon! Thanks for the suggestion, but now I can't move the actor at all. Any idea?
    The rules you are using have probably just been set up incorrectly.
  • LeonardDeveloperLeonardDeveloper Member Posts: 4,630
    @findmattcox
    Here's a "follow my finger" template I made a while ago (Free)
    http://gshelper.com/shop/gamesalad-templates/decelerate-to-touch-template/
  • findmattgamesfindmattgames Member, PRO Posts: 100
    @findmattcox
    Here's a "follow my finger" template I made a while ago (Free)
    http://gshelper.com/shop/gamesalad-templates/decelerate-to-touch-template/
    Hi Leonard! Yep. Yours is the one I am working off of, but I need the actor to stick to the mouse, not lag behind it. If you have a way to do that I'd love to know!
  • findmattgamesfindmattgames Member, PRO Posts: 100
    @Braydon and @KevinCross Thanks guys, I got it to follow the mouse. But now when it collides with actos, it doesn't have a physical reaction. I.E. the balls that are hit don't roll according to the force I swipe them with. Ideas?

    Also it no longer collides with walls.
  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    Its probably worth Checking this out. Theres honestly tons of different ways to make an actor follow your finger. you just have to spend the time playing with it to make something work the way you want it. I'm sure there are other demos on gshelper about following the mouse or finger as well.

    http://gshelper.com/shop/advanced-game-functions/constrain-to-mouse-and-keep-collision-gamesalad/
Sign In or Register to comment.