How Do You Make An Actor Follow Your Finger?
LittleGreenGames
Member Posts: 20
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.
Thanks in advance.
P.S. This is a school project so just post anything I need the info quick.
Comments
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"
hope your project works out. :P
@Dazza006 Apologies
@ebarr24
Follow the project file and youll figure out how I got .y
Hope it helps,
LD
No bother man
constrain self position X to mouse position X
constrain self position Y to mouse position Y
My GameSalad Academy Courses! ◦ Check out my quality templates! ◦ Add me on Skype: braydon_sfx
It should work
Here's a "follow my finger" template I made a while ago (Free)
http://gshelper.com/shop/gamesalad-templates/decelerate-to-touch-template/
Also it no longer collides with walls.
http://gshelper.com/shop/advanced-game-functions/constrain-to-mouse-and-keep-collision-gamesalad/