Move Callbacks

Ender Nafi Elekcioglu endernafi at gmail.com
Tue Oct 29 16:36:48 EDT 2013


Ray,

Getting callbacks from the *move* should definitely be offered to the feature improvement list.

But in the meantime, custom handlers may work better.
I’m dealing with *move* command for my current project;
so, I wanted to give a try to both methods.

It seems that using *move* command is more laggy than a custom handler.
I’ve created 3 buttons and 3 random freehand curves.
Then I put following code into the stack’s script, for a comparison:

_on mouseDown
__move button 1 to the points of graphic "line1" without waiting
__move button 2 to the points of graphic "line2" without waiting
__move button 3 to the points of graphic "line3" without waiting
_end mouseDown

_on mouseUp
__put the long id of button 1 into tObjectID
__put the points of graphic "line1" into tPoints
__send "moveObject tObjectID, tPoints" to me in 0 milliseconds
__
__put the long id of button 2 into tObjectID
__put the points of graphic "line2" into tPoints
__send "moveObject tObjectID, tPoints" to me in 0 milliseconds
__
__put the long id of button 3 into tObjectID
__put the points of graphic "line3" into tPoints
__send "moveObject tObjectID, tPoints" to me in 0 milliseconds
__
_end mouseUp

_on moveObject pObjectID, pPoints
__set the loc of pObjectID to line 1 of pPoints
__delete line 1 of pPoints
__if the number of lines of pPoints > 0 then send "moveObject pObjectID, pPoints" to me in 0 milliseconds
_end moveObject


That custom handler is not smoothest, I know, but at least the programmer has full control of it and it’s still far better than built-in *move* command.
Different instants of it {3, in this case} can be synced via a method like the updateScreen as seen in the spaceship game of LiveCode’s Game Academy.

Just sharing my findings...

Best,

~ Ender Nafi


On October 29, 2013 at 19:50:49, Ray (ray at linkit.com) wrote:

Ender,

That's what I was afraid of.  Thanks for the code ideas.  Maybe I'll post something on the improve list.  It would be useful if the move command returned something so more than just moving object could be done.

Ray



More information about the Use-livecode mailing list