ID:266483
Mar 18 2002, 8:39 pm
|
|
I'm curious how I'd do/come around to this, to make an object follow the mouse pointer as say you hold down left or right click???
|
In response to Spuzzum
|
|
You could also do it with the MouseDrag() proc. It gives you the current location of the pointer and is called whenever that location is changed. Meaning, everytime it moves you could alert what is supposed to be following it to walk towards its location.
|
Pretty tough, but possible.
You'd have to look into turf/MouseEntered() and turf/MouseExited() for determining where the player's mouse is currently, then set that to a mob/var/turf/target variable. Then have the object pursue usr.target relentlessly.
If you want it to operate with holding the mouse pointer down, you'd have to include some kind of flag -- eg. mob/var/pointer_down = 0. When client/MouseDown() is called, set that pointer_down to 1. When client/MouseUp() is called, set pointer_down back to 0. In that case, you'd have to check to make sure usr.pointer_down is true before changing the target variable when the player moves the mouse around the map.
In any case, however, I'd recommend avoiding this, since mouse-overing is a big source of lag -- the client has to tell the server everything it does, which slows down the server incredibly.
Right now there is no way to make anything happen with right-click. Right click is reserved for the verbs menu.