Making my character move & animate in the direction I touch
dkurien
Member Posts: 7
So I've created a character actor which I can move around anywhere on the screen according to my touch using the constraint attribute:
Constraint Attribute: self.Position.x = game.Touches.Touch 1.X
Constraint Attribute: self.Position.y = game.Touches.Touch 1.Y
Which works great. But now I want it to animate according to the direction that it's moving in.
I tried to create a Rule:
When Attribute: self.Motion.Linear Velocity.X > 0.0
Animate: sequence of images of character moving to the right
When Attribute: self.Motion.Linear Velocity.X < 0.0
Animate: sequence of images of character moving to the left ...
.. but nothing happens. What am I doing wrong, and how do I fix it so that it does what I want it to do ?
Appreciate your help.
Thanks,
Denny
Constraint Attribute: self.Position.x = game.Touches.Touch 1.X
Constraint Attribute: self.Position.y = game.Touches.Touch 1.Y
Which works great. But now I want it to animate according to the direction that it's moving in.
I tried to create a Rule:
When Attribute: self.Motion.Linear Velocity.X > 0.0
Animate: sequence of images of character moving to the right
When Attribute: self.Motion.Linear Velocity.X < 0.0
Animate: sequence of images of character moving to the left ...
.. but nothing happens. What am I doing wrong, and how do I fix it so that it does what I want it to do ?
Appreciate your help.
Thanks,
Denny
Comments
(When you constrain and actor and move it around there is no linear velocity x or y)
Lump Apps and My Assets
Use this instead:
Constrain: self.motion.Linear Velocity.X to ( game.Touches.Touch 1.X - self.Position.x )*20
Do the same for Y
Now you should get your speed reading you need.
Also, you can increase or decrease the multiplier ("20" in this example). Increase will make the movement faster, while decreasing will make the movement slower.
Thank you LudwigHeijden - your video tutorial and template was most helpful.
Cheers!
http://CountDracu.com
I hope the characters are mobile now thanks to the dude
Lump Apps and My Assets