Have actor run away from mouse?
Larry Winters
Member Posts: 13
Greetings: I'm trying to have my actor run away from the mouse. Basically, the player touches the actor and it scoots away from the touch. Any idea on how to do this? Thanks!
Comments
Accelerate towards mouse x, mouse y, speed -100.
Or use move, or move to, or change velocity . . . . etc.
Thanks so much for this! Testing it out, I think I want it more to look like the player touches the actor and then the actor moves to random points on the screen. Would I do that with change attribute self.position X,y?
It you used change attribute then the actor would instantly jump to the new position, instead it might look better if you interpolated the actor's position to its new value.
Make a couple of attributes for the actor's target destination, let's call them TX and TY
Rule: when touch is pressed
--change TX to random (0,1024)
--change TY to random (0,768)
--interpolate self X to TX
--interpolate self Y to TY
This is very helpful! Thank you! Works great!