EditMake an actor follow the mouse
Basic Idea: Define 'Motion' behavior that follows mouse.
Sample Game:
Sample:
http://www.popfly.com/users/team/HowDoI-FollowMouse
Details:
- Define a behavior for mouse event 'Anywhere'
Actor->Behaviors->Event
 Follow Mouse Event (Click the image to view full size) |
- Define the motion for 'Mouse' and increase its speed to a big number (like 2000). Select motion direction as 'Toward'. This makes the actor snap to the location where the mouse was clicked. If you use lower speed, then actor will move slowly towards the mouse pointer.
 Follow Mouse Motion (Click the image to view full size) |
Notes:
- If you define the event as 'While Down' instead of 'Press' and set the motion to take place 'While Receiving Event' instead of 'Forever' then actor will move towards the mouse click only while mouse button is down.
- By using 'Actor' instead of 'Mouse' in the 'Relative to' selection, you can make your actor follow or run away from another actor