Going straight in one direction

gariantrollgariantroll Member Posts: 219
edited November -1 in Working with GS (Mac)
Hey Guys, I Am trying to have the player input in a location with a touch and from there an actor is spawned and goes to that location, in a straight line, but I want the actor to travel past the selected location, but at a constant speed. I guess it would be similar to the Accelerate toward, but with out the acceleration. I tried the move to Behavior but it stops at the location where I want it to go past and continue traveling. Any ideas?
Thanks

Comments

  • xarmianxarmian Member Posts: 124
    currX = current X position of actor (i.e. where it spawned)
    currY = current Y position of actor
    tapX = X position where user tapped (i.e. game.tapX)
    tapY = Y position where user tapped

    Use Change Velocity in the spawned actor to set the velocity with a rotation of:

    vectorToAngle(currX-tapX,currY-tapY)

    That should do it...

    Dave
  • gariantrollgariantroll Member Posts: 219
    Dave,
    Thanks for your help, I got it to work.
    YESSSSSS!!!!!!!!
Sign In or Register to comment.