This is not an easy question :-)
First let me see if I have understood. The Random Movement is created as a Bézier curve. The sprite moves along the curve, and when it reaches the end, a new random curve is created, and it follows that.
Each time a new curve is created, you want the sprite to turn to face the far end of the curve. As it travels along the curve, you want it to keep facing the end of the curve, a bit like the way Robocop moves.
Is that right?
Could you explain what effect you are working to achieve? What does the randomly moving sprite represent? What does it mean to have it facing in a particular direction?
Yes, that's what I mean.
I am creating sprites that are little bug-like creatures. They have a "foward-facing" end that I want to be, well, rotated to face forward in the direction they move so they don't appear to be traveling backward or sideways.
If they are bugs, then I imagine that you want two things to happen:
- The bugs will always face in the direction of their next step (rather than at their destination)
- When a bug reaches the end of its current path, the new path should continue in the same direction, so that there is no abrupt change in direction.
These changes will require some radical modifications to the Random Movement behavior.
If you really want a movement like the one I described, then you can take a look at this:
Thank you so incredibly much for your help. This works perfectly. And I added a few lines of code and moved behaviors around so that my little critters face the cursor when the mouse is pressed down and successfully return to their movement behaviors without a hitch. It feels so good to see things working correctly. Your time and help has been greatly appreciated.