How to make an actor follow a mouse click.
bgjoanbg
Member Posts: 17
Hi, I'm trying to make an actor go to the position where where a mouse click was executed. Right now when I click, the actor goes to the mouse position, not were the click was executed.
I have a rule which says:
If the mouse click is executed and the mouse position (X and Y) is outside the actor, MOVE TO mouse position.
Is there anyway I can make it go to the click?
Please help.
I have a rule which says:
If the mouse click is executed and the mouse position (X and Y) is outside the actor, MOVE TO mouse position.
Is there anyway I can make it go to the click?
Please help.
Comments
rule when mouse down
change attribute self.savedX = mouse.poisition.x
change attribute self.savedY = mouse.position.y
moveTo(self.savedX, self.savedY)
Additionally, see my example here for a whole other way of doing it completely unrelated to the above example, but also really good for seeing how there is more than one way to skin a cat. The example below uses vectors and distance and time.
http://gamesalad.com/game/play/76525