Pull an actor...
pauljaappdev
Member Posts: 10
Looking for a method that will pull actor1 towards actor2 when actor1 comes with a given distance of actor2. I want actor1 to be able to "get away" from the pull of actor2 but not w/out some effort - i.e. using the direction keys I have setup to move it along X and Y.
Actor2 is a spawned actor and actor1 is traveling along the Y axis, if that makes any difference.
Any ideas?
Comments
Maybe something like this will spark some ideas.
Hmm. I like the way your game is configured and it functions similar to what I'm after, but the configuration you have setup does not seem to affect the actors in my game in the same manor even after I made all the necessary translations from yours to mine.
My setup is:
Actor1 (friendly) is stationary
Actor2 (enemy) is moving along the Y axis to the right of Actor1
D & A keys affect Actor1's X coordinates w/the accelerate attribute
I haven't worked with the vectorToAngle or magnitude attributes and I'm not even sure how they function.
I'll give the GS manual a read and see if it sheds any light on those two attributes.
Appreciate you putting together a demo. Any ideas on why it might not be functioning the same on mine?
My first guess is that you might have typed in the expressions (magnitude, vectorToAngle) directly into the input field, instead of opening up the expression editor.
My second guess is that there is a slight typo somewhere.
As you can see, the expressions do work.
There are also other ways to achieve similar results. It really depends on knowing how you want the actors to behave.