>Using baplacecursor(from xtra "budapi") I'd like to simulate the cursor
>drawing (slowly) an invisible but exact line beetween two arbitrary points.
>But I've not the math for the angle. Any suggestion?
It doesn't take much math, just divide the difference between the two
locations by the number of steps you want to take, and then
repeatedly move the cursor by that much. Keep the arithmetic as
floating point, otherwise you'll get an accumulating error. The way I
tend to do it is to do the movement one less times that you need, and
then at the end lock it to the destination point. That way you don't
risk a rounding mistake.
Here's an example which you can put on a sprite to see the effect:
on mouseUp
s = the currentspritenum
oldloc = the loc of sprite s
newloc = point(random(640),random(480))
locdifx = float(newloc[1] - oldloc[1])/50
locdify = float(newloc[2] - oldloc[2])/50
repeat with a = 1 to 49
sprite(s).loch = oldloc[1] + locdifx * a
sprite(s).locv = oldloc[2] + locdify * a
updatestage
starttimer
repeat while the timer < 2
end repeat
end repeat
sprite(s).loc = newloc
end
[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/LUJ/lingo-l.cgi To post messages to the list,
email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED])
Lingo-L is for learning and helping with programming Lingo. Thanks!]