Making my character move & animate in the direction I touch

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

Comments

  • LumpAppsLumpApps Member Posts: 2,881
    edited May 2013
    Perhaps this helps: http://forums.gamesalad.com/discussion/47835/tutorial-frame-rate-depending-on-velocity-video-and-free-template#latest

    (When you constrain and actor and move it around there is no linear velocity x or y)
  • ericzingelerericzingeler Member Posts: 334
    edited May 2013
    Your problem lies in the constrain position actions. Constraining a position is not actually moving the actor, but instead changing its position attributes at a very fast rate.

    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.

  • dkuriendkurien Member Posts: 7
    Awesome! Thank you EricZingeler - that worked like a charm.
    Thank you LudwigHeijden - your video tutorial and template was most helpful.
    Cheers!
    http://CountDracu.com
  • LumpAppsLumpApps Member Posts: 2,881
    There is something wrong with your link. I got there in the end and saw the video nice!
    I hope the characters are mobile now thanks to the dude ;)
Sign In or Register to comment.